• panda

    (@alejorostata)


    So I created a custom toolbar intended to replace the default toolbar in product archive(Shop page) contains Filter, Sorting View, and Pagination, it simply didn’t meet the requirements I needed for my project.

    I created the custom toolbar using Elementor and by going to Theme panel > My Library > Add New, and currently, the shortcode for it is [oceanwp_library id="798"].

    I don’t know what’s the hook if there is any in order to replace the toolbar only in the product archive(Shop page). Otherwise, what is the other method to change it?

    add_action( '??????????', 'change_product_archives_toolbar' );
    function change_product_archives_toolbar() {
      echo do_shortcode( '[oceanwp_library id="798"]' );
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • Nico

    (@nicolamustone)

    Automattic Happiness Engineer

    Hello there,
    The hook you’re looking for is woocommerce_before_shop_loop.

    You can find the filters and sorting parts of the template added via these hooks: https://github.com/woocommerce/woocommerce/blob/0686e6f1cd8d72c554cc2a0f4f13edf22b25be6d/includes/wc-template-hooks.php#L76-L77

    Thread Starter panda

    (@alejorostata)

    @nicolamustone – No, I wanted to replace the default toolbar with something else. I want to remove the whole toolbar including the filter, sorting and replace it with the one I created.

    Something like…

    
    //remove the toolbar
    remove_action('????????', '?????...toolbar');
    
    //add custom toolbar
    add_action( '??????????', 'change_product_archives_toolbar' );
    function change_product_archives_toolbar() {
      return do_shortcode( '[oceanwp_library id="798"]' ); //shortcode for the custom toolbar, created using Theme Panel > Library
    }
    • This reply was modified 4 years, 7 months ago by panda.
    • This reply was modified 4 years, 7 months ago by panda.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Woocommerce Product Archives(Shop Page) – Custom Toolbar’ is closed to new replies.