• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Show product variation in woocommerce shop page

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Show product variation in woocommerce shop page

This topic is: not resolved

Tagged: pre_get_posts, product variation, Shop Page, WooCommerce

  • This topic has 2 replies, 2 voices, and was last updated 2 years, 9 months ago by stefaeva.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • May 31, 2020 at 5:39 pm #499069
    stefaeva
    Member

    Good morning,
    i'm using genesis sample theme and i've installed woocommerce and genesis for woocommerce plugin. I found the following snippet to don't show the products in the defualt shop page

    [php] add_action( 'pre_get_posts', 'custom_remove_products_from_shop_page' );
     
    function custom_remove_products_from_shop_page( $q ) {
       if ( ! $q->is_main_query() ) return;
       if ( ! $q->is_post_type_archive() ) return;
       if ( ! is_admin() && is_shop() ) {
          $q->set( 'post__in', array(0) );
       }
       remove_action( 'pre_get_posts', 'custom_remove_products_from_shop_page' ); [php]

    I have two variable products, each one with three variations. In the array i'd like to have just product variations, without the parent product.
    Someone can give me some help hot to set the wp_query so it looks for just product variation? Thanks in advance

    https://prova.extravergineorsini.it/index.php/shop/
    May 31, 2020 at 6:32 pm #499070
    Brad Dalton
    Participant

    You might want to try the WooCommerce group on facebook or WooCommerce support.


    Tutorials for StudioPress Themes.

    June 1, 2020 at 1:12 am #499073
    stefaeva
    Member

    OK, i'll try. Thanks

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble