[Support request] How to disable product-loop on shop-page?

Home Forums Support [Support request] How to disable product-loop on shop-page?

Home Forums Support How to disable product-loop on shop-page?

  • This topic has 5 replies, 3 voices, and was last updated 1 year ago by Fernando.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2553593
    Sascha

    Hi,

    I have defined a custom-page “Angebote” as the default shop page, and only want to display products by custom query-loops (or by ninja-tables).

    I checked GPP-Customizer and didn’t find the relevant option.

    Then I added this code-snippet, but does not work:

    function remove_woocommerce_shop_loop() {
        remove_action( 'woocommerce_shop_loop', 'woocommerce_output_all_notices', 10 );
        remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
        remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
        remove_action( 'woocommerce_before_shop_loop', 'woocommerce_output_all_notices', 10 );
        remove_action( 'woocommerce_before_shop_loop', 'woocommerce_breadcrumb', 20 );
        remove_action( 'woocommerce_before_shop_loop', 'woocommerce_template_loop_product_link_open', 10 );
        remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
        remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
        remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
        remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
        remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_product_link_close', 5 );
    }
    
    add_action( 'init', 'remove_woocommerce_shop_loop' );

    Can you help me hiding or removing the products from the shop page?

    Thank you in advance and kind regards,
    Sascha

    #2553894
    David
    Staff
    Customer Support

    Hi there,

    Woocommerce handles that.
    In Dashboard > Woocommerce > Settings -> Products, the Shop page option, if that is set then Woo will automatically add the shop loop to that page.
    So the simple fix is to NOT set the shop page.

    Then you need to change the return to shop url to match that with this snippet:

    function return_to_static_shop_page() {
        return 'http://yourdomain.com/your-page/';
    }
    add_filter( 'woocommerce_return_to_shop_redirect', 'return_to_static_shop_page' );
    #2569526
    Sascha

    Thanks for your clarification.

    By the way, will it be possible to display products-fields via GB dynamic data in the future? Or do you know of any solution about how to do so?

    #2569531
    Fernando
    Customer Support

    Hi Sascha,

    Product meta should be already retrievable through GB dynamic data.

    Just set the source to Post meta, and the field name to_regular_price for instance. That should work.

    #2616249
    Sascha

    Hey Fernando, that’s great to hear, thanks!

    Now, I have tried to find a list or guide about how to display product-meta correctly, any idea about where I find a list of possible meta to add to the custom meta field of a GB-Headline? Like for pricing variants, tax, “sales” badge etc.?

    Thank you in advance and kind regards,
    Sascha

    #2616377
    Fernando
    Customer Support

    I don’t think WooCommerce has an official public list of these.

    I usually just Google and try whatever suggested meta field name works. I found this article which may help as well: https://docs.om4.io/woocommerce-zapier/data-fields/product/#data-fields-for-triggers-and-usage-in-create-and-update-actions

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.