Does anyone know how to put code into your theme that will only shop up on WooCommerce pages? I want to add a cart link but don't need it to shop up on the rest of the site. Thanks!


If I understood correctly what you need no do is override WooCommerce templates. You can do this in your theme/child-theme directory. More detailed documentation can be found here --> https://docs.woocommerce.com/document/template-structure/

If you need further assistance please don't hesitate to ask.


You can simply put your code in the is_woocommerce() conditional tag.

Returns true if on a page which uses WooCommerce templates (cart and checkout are standard pages with shortcodes and thus are not included).

For example:

if ( is_woocommerce() ) {
    enter code here

Read more information about WooCommerce Conditional tags at https://docs.woocommerce.com/document/conditional-tags/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.