WOOT - WooCommerce Active Products Tables

WooCommerce-Produkt-Shortcodes in die einzelne Produktseite einfügen

Mit den WooCommerce-Produkt-Shortcodes können Sie der einzelnen Produktseite zusätzliche Tabellen hinzufügen — Variationen, Upsells, Cross-Sells und verwandte Produkte. Öffnen Sie dazu bitte dieses Beispielprodukt.

  • Um eine Tabelle mit den Produktvariationen einzufügen, verwenden Sie in der Datei functions.php den folgenden Code:
    add_filter('woocommerce_after_add_to_cart_button', function() {
        global $product;
    
        if (is_object($product) AND $product->is_type('variable')) {
            echo do_shortcode("[woot_variations per_page=4 columns='thumbnail,pa_size,pa_color,price,add_to_cart']");
        }
    });

    Die Attributspalten sind hier optional.
  • Um „Herz, Galerie, Popup-Button“ auf der einzelnen Produktseite einzufügen, verwenden Sie den folgenden Code in der Datei functions.php:
    add_filter('woocommerce_product_meta_end', function() {
        echo '

    ' . do_shortcode('[woot_favourites_single_btn]'); echo '

    ' . do_shortcode('[woot_gallery]'); echo '

    ' . do_shortcode('[woot_popup_iframe_button popup_page_link='https://demo.products-tables.com/wpform-contact-ask-me/' button_text='Send message to the product manager' popup_title='Popup header title' css_class='woot-btn']'); echo '


    ' . do_shortcode("[woot_single_btn button_text='Extended information' css_class='woot-btn']").'
    '; });
  • Tabellen mit Anhängen platzieren Sie direkt im Texteditor per Shortcode [woot_attachments columns="title,file,description"]
  • Die Tabs Bewertungen, Zusätzliche Informationen, WOOT Cross Sells, WOOT Upsells und WOOT Related werden mit dem folgenden Code in der Datei functions.php angepasst und hinzugefügt:
    add_filter('woocommerce_product_tabs', function ($tabs) {
        $tabs['reviews'] = array(
            'title' => __('WOOT Reviews', 'woocommerce'),
            'priority' => 49,
            'callback' => function() {
                $product_id = get_the_ID();
                echo '
    ' . do_shortcode("[woot_reviews id={$product_id}]") . '
    '; } ); $tabs['additional_information'] = array( 'title' => __('Additional information', 'woocommerce'), 'priority' => 50, 'callback' => function() { $product_id = get_the_ID(); echo do_shortcode("[woot_single id={$product_id} columns='weight,height,width,pa_size,pa_color,gallery']"); } ); $tabs['woot_cross_sells_tab'] = array( 'title' => __('WOOT Cross Sells', 'woocommerce'), 'priority' => 50, 'callback' => function() { $product_id = get_the_ID(); echo do_shortcode("[woot_cross_sells id={$product_id}]"); } ); $tabs['woot_upsells_tab'] = array( 'title' => __('WOOT UpSells', 'woocommerce'), 'priority' => 50, 'callback' => function() { $product_id = get_the_ID(); echo do_shortcode("[woot_upsells id={$product_id}]"); } ); /* $tabs['woot_grouped_tab'] = array( 'title' => __('WOOT Grouped', 'woocommerce'), 'priority' => 50, 'callback' => function() { $product_id = get_the_ID(); echo do_shortcode("[woot_grouped id={$product_id}]"); } ); */ $tabs['woot_related_tab'] = array( 'title' => __('WOOT Related', 'woocommerce'), 'priority' => 50, 'callback' => function() { $product_id = get_the_ID(); echo do_shortcode("[woot_related id={$product_id}]"); } ); return $tabs; });

Weiterführende Links: