wc_dropdown_variation_attribute_options نمایش ویژگی های متغیر محصول سبد خرید

wc_dropdown_variation_attribute_options نمایش ویژگی های متغیر محصول سبد خرید

تابع ووکامرسی wc_dropdown_variation_attribute_options – نمایش ویژگی های متغیر در سبد خرید محصول

Syntax – سینتکس

wc_dropdown_variation_attribute_options( (array) $args = array() ); 

Parameters – پارامتر ها (1)

  • 1- $args (array)

Usage – نحوه استفاده

if ( !function_exists( 'wc_dropdown_variation_attribute_options' ) ) { 
    require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-template-functions.php'; 
} 
  
// The args. 
$args = array(); 
  
// NOTICE! Understand what this does before running. 
$result = wc_dropdown_variation_attribute_options($args); 
    

Defined – محل تعریف

/includes/wc-template-functions.php

function wc_dropdown_variation_attribute_options( $args = array() ) { 
    $args = wp_parse_args( apply_filters( 'woocommerce_dropdown_variation_attribute_options_args', $args ), array( 
        'options' => false,  
        'attribute' => false,  
        'product' => false,  
        'selected' => false,  
        'name' => '',  
        'id' => '',  
        'class' => '',  
        'show_option_none' => __( 'Choose an option', woocommerce ),  
 ) ); 
 
    $options = $args['options']; 
    $product = $args['product']; 
    $attribute = $args['attribute']; 
    $name = $args['name'] ? $args['name'] : 'attribute_' . sanitize_title( $attribute ); 
    $id = $args['id'] ? $args['id'] : sanitize_title( $attribute ); 
    $class = $args['class']; 
    $show_option_none = $args['show_option_none'] ? true : false; 
    $show_option_none_text = $args['show_option_none'] ? $args['show_option_none'] : __( 'Choose an option', woocommerce ); // We'll do our best to hide the placeholder, but we'll need to show something when resetting options. 
 
    if ( empty( $options ) && ! empty( $product ) && ! empty( $attribute ) ) { 
        $attributes = $product->get_variation_attributes(); 
        $options = $attributes[ $attribute ]; 
    } 
 
    $html = ''; 
 
    echo apply_filters( 'woocommerce_dropdown_variation_attribute_options_html', $html, $args ); 
} 

versions – نسخه ها

از نسخه : 2.4.0

نسخه فعلی : 3.0.6

دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2

ارسال نظر

جهت استفاده از کد حتما از تگ pre استفاده نمایید .

contact us