• Resolved edmartin123

    (@edmartin123)


    Scenario: We are photographers. I want to display an image in my store and when the customer clicks on it, they are able to select what they want to buy using that image – for example a banner, a yard sign and/or a fathead.

    I am using the Product Add-Ons plugin to offer prices. So, the image itself doesn’t really have a cost. What I have set up as add-ons (banner, yard sign, etc) are priced.

    I want to hide price & “add to cart” on the product-category pages. On the product page, the price is determined by checking the various add-on options.

    I see plugins that switch the entire store into catalog mode. That’s more than what I want to do. I just want to hide price and “add to cart” on the product-category pages.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello,

    I want to hide price & “add to cart” on the product-category pages. On the product page, the price is determined by checking the various add-on options.

    This can be done by adding the below code:

    remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );

    I would recommend using a plugin like?Code Snippets?to add the snippet to your site.

    Here is a link to the guide on how to apply custom codes via the Code Snippets plugin: https://woocommerce.com/document/customizing-woocommerce-best-practices/#section-4

    Thread Starter edmartin123

    (@edmartin123)

    Well, when I tried inserting that code using Code Snippets, it crashed my site. It’s now down with a 502 error. I can’t even log into the dashboard to try to turn off the snippet. Any ideas?

    @edmartin123

    You can manually turn off the code snippets plugin using the guide below:
    https://kinsta.com/knowledgebase/disable-wordpress-plugins/

    Once, you’re able to get back in WP-admin, you can change the theme to Storefront, reactivate the code snippets plugin and check if the code above works.

    I look forward to hearing from you.

    Thread Starter edmartin123

    (@edmartin123)

    Crisis resolved. Thanks! I’m back up and running.

    Back to the original question/answer. Maykato, where would I insert the 2 lines of code above using the Code Snippets addon?

    Hey @edmartin123

    The Code Snippets plugin allows you to add snippets to your site rather than pasting them in the functions.php file, write a brief description so you know what it does, and activate or deactivate these snippets as needed.

    That being said, you can:

    1. Create a new Snippet (WordPress Dashboard > Snippets > Add new)
    2. Add a name;
    3. paste the code in the Code field.
    4. Add a description (optional).

    And hit the Save Changes button! It’s all set!

    You can find these instructions here too:

    https://woocommerce.com/document/customizing-woocommerce-best-practices/#section-4

    Let me know if you have questions! All the best!

    • This reply was modified 2 years, 8 months ago by André.

    Hi @edmartin123

    We’ve not heard back from you in a while, so I’m marking this thread as resolved. If you have further questions, please feel free to open a new topic.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Hide price only on product-category pages’ is closed to new replies.