WPML
add_filter( 'wcml_is_variable_product', 'the_callback_function', 10, 2 );
סוג
filter
קטגוריה
שונות
גרסת WooCommerce Multilingual
3.8

תיאור

הוסף פילטרים כדי לבדוק אם מוצר הוא משתנה. זה שימושי עבור הרחבות WooCommerce שיש להן סוגי מוצרים משתנים משלהן.

ארגומנטים

לפילטר זה מועברים שני פרמטרים:
$is_variable
(bool) האם המוצר הוא משתנה או לא.
$product_id
(integer) מזהה (ID) של המוצר.

דוגמה לשימוש

דוגמה
/**
 * This example is extracted from the Adventure Tours compatibility class in the WCML code. 
 */

add_filter( 'wcml_is_variable_product', 'is_variable_tour', 10, 2 );

function is_variable_tour( $is_variable, $product_id ){
    $var_tour_meta = get_post_meta( $product_id, '_variable_tour', true );

    if( $is_variable && $var_tour_meta == 'yes' ){
        $is_variable = true;
    }elseif( $var_tour_meta == 'no' ){
        $is_variable = false;
    }

    return $is_variable;
}

wcml_new_order_admin_email_language, translate_shipping_methods_in_package, wcml_gui_additional_box_html, wcml_current_gateway_language, wcml_variation_term_taxonomy_ids, wcml_is_attributes_page, wcml_gui_additional_box_data, wcml_after_load_lock_fields_js, wcml_wc_installed_pages, wcml_not_display_single_fields_to_translate

כל 12 ההוקים בקטגוריה שונות →