Nehmen wir an, Sie möchten optionales und obligatorisches Zubehör vor den entsprechenden Produkten und nicht am unteren Rand anzeigen. Dann können Sie den folgenden Code innerhalb der Funktionen Ihres untergeordneten Themas verwenden.php:Obligatorisches Zubehör:

remove_action( 'woocommerce_after_single_product_summary', array( $WooCommerce_Product_accessories->plugin_public, 'woocommerce_mandatory_accessories_display' ), 25 );add_action( 'woocommerce_after_single_product_summary', array( $WooCommerce_Product_accessories->plugin_public, 'woocommerce_mandatory_accessories_display' ), 5 );

Optionales Zubehör:

remove_action( 'woocommerce_after_single_product_summary', array( $WooCommerce_Product_accessories->plugin_public, 'woocommerce_optional_accessories_display' ), 30 );add_action( 'woocommerce_after_single_product_summary', array( $WooCommerce_Product_accessories->plugin_public, 'woocommerce_optional_accessories_display' ), 5 );

5 Ist die neue Position für beide Elemente.

5 Meinungen zu “Produktzubehör ändern Position

  1. Daniel Henningsson sagt:

    Hello,

    How can I change to get the optional accessories after the product description? With your code above it gets displayed before the product description.

  2. jake sagt:

    How do I put the mandatory accessories in a tab? I’ve tried so many ways but nothing works. 🙁

    //add tabs
    add_filter(‘woocommerce_product_tabs’, ‘woo_new_product_tab’);

    function woo_new_product_tab($tabs)
    {

    global $post;
    $tech_specs_data = get_field(“tech_specs”);
    $product_specs_data = get_field(“product_specs”);
    $video_tab_data = get_field(“video_tab”);
    $included_items_tab_data = array($WooCommerce_Product_Accessories->plugin_public, ‘woocommerce_mandatory_accessories_display’);

    // Adds the new tab

    if (!empty($product_specs_data)) {

    $tabs[‘product_specs’] = array(
    ‘title’ => __(‘Packing List’, ‘woocommerce’),
    ‘priority’ => 15,
    ‘callback’ => ‘woo_new_product_specs_content’
    );
    }

    if (!empty($included_items_tab_data)) {
    $tabs[‘included_items_tab_data’] = array(
    ‘title’ => __(‘Replacement Parts’, ‘woocommerce’),
    ‘priority’ => 20,
    ‘callback’ => ‘woocommerce_optional_accessories_display’
    );
    }

    if (!empty($tech_specs_data)) {
    $tabs[‘tech_specs’] = array(
    ‘title’ => __(‘Technical Data’, ‘woocommerce’),
    ‘priority’ => 25,
    ‘callback’ => ‘woo_new_tech_specs_content’
    );
    }

    if (!empty($video_tab_data)) {
    $tabs[‘video_tab’] = array(
    ‘title’ => __(‘Tutorial Video’, ‘woocommerce’),
    ‘priority’ => 35,
    ‘callback’ => ‘woo_new_video_tab_content’
    );
    }

    return $tabs;

    }

    function woo_new_product_specs_content()
    {

    echo get_field(“product_specs”);

    }

    function woo_new_tech_specs_content()
    {

    echo get_field(“tech_specs”);

    }

    function woo_new_video_tab_content()
    {

    echo get_field(“video_tab”);

    }

    function woo_new_included_items_tab_content()
    {
    echo array( $WooCommerce_Product_Accessories->plugin_public);

    }

    add_action( ‘woo_new_included_items_tab_content’, array( $WooCommerce_Product_Accessories->plugin_public, ‘woocommerce_optional_accessories_display’ ), 5 );

  3. Stuart sagt:

    Hi
    I would like to display the accessories within one of the product tabs, ideally a custom tab I have created. Is there a hook or something I can use to loop the connected accessories?

    Thanks
    Stuart

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert