I dont sell free products - by peter4576

This topic has 4 replies, 2 voices, and was last updated 8 years, 9 months ago ago by Eva Kemp

  • Avatar: peter4576
    peter4576
    Participant
    July 18, 2015 at 11:07

    Hi there.

    I have some “dead products” with no price. But instead of not displaying they come up with the text GRATIS/ FREE! This is a killer.

    It may just be default WooCommerce. But then I would expect you to contact WooCommerce and find out what to do, so you can help improving your theme.

    Thank you very much

    Peter

    https://gofile.me/6lYKv/fSiJAZzY

    3 Answers
    Avatar: Eva
    Eva Kemp
    Support staff
    July 18, 2015 at 12:16
    Avatar: peter4576
    peter4576
    Participant
    July 22, 2015 at 13:35

    HI again

    First link didnt work, and I am unsure about this code, if that will do what I asked?

    dd_action( ‘pre_get_posts’, ‘custom_pre_get_posts’ );

    function custom_pre_get_posts( $q ) {

    if ( ! $q->is_main_query() ) return;
    if ( ! $q->is_post_type_archive() ) return;

    if ( ! is_admin() && is_shop() ) {

    $q->set( ‘tax_query’, array(array(
    ‘taxonomy’ => ‘product_cat’,
    ‘field’ => ‘slug’,
    ‘terms’ => array( ‘private-clients’, ‘charity’), // Don’t display products in the private-clients category on the shop page
    ‘operator’ => ‘NOT IN’
    )));

    }

    remove_action( ‘pre_get_posts’, ‘custom_pre_get_posts_query’ );

    }

    Avatar: Eva
    Eva Kemp
    Support staff
    July 22, 2015 at 14:27

    Hello,

    Products page is configured by Woocommerce and if you want to modify it or remove some products types then you should ask Woocommerce support for proper code to achieve what you want.

    Thank you for understanding.

    Regards,
    Eva Kemp.

  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.