I am using a third party plugin that allows me to charge users to post things on my site. I have used that and Paid Memberships Subscription together to create a system where users can create a certain number of posts in a certain number of time.
At the moment what is happening is, once the product can not be purchased anymore (because the limit has been reached), the product still displays, and when the user tries to buy it, they are shown the direct Woocommerce cart page. This doesn’t look good.
What I would like is, once the time or the number of posts has been reached, the product does not appear as an option to be purchased any more so I can avoid the Woocommerce cart page showing at all (I’ve tried deleting the Cart page but then when the person tries to purchase the item, it shows a “Nothing found” error page). Is there a way I can achieve this?
]]>Is there any way to get them to show up on the special category page, but not on the main page or the search results page.
]]>Thanks.
]]>When a piece is sold, I don’t want to continue to display that product in the current shop catalogue. (EVEN if a “sold out” badge would be shown with it.)
I would like to show all sold pieces only in an archive.
How can I hide sold pieces from the store catalogue but display them in a past products archive?
thanks for any help!
]]>But, that item is appearing at the main shop page (where the affiliate links are). How to hide it from there and only show it at its link?
Ive found the following code which I have NO IDEA where to put it or if I should put it or even what it does, but I searched first on the forum and found a question very similar to mine. This was the solution. Do you think its a good solution for me? If so, what do I do with it?
add_action( ‘woocommerce_product_query’, ‘prefix_custom_pre_get_posts_query’ );
/**
* Hide Product Cateories from targetted pages in WooCommerce
* @link https://gist.github.com/stuartduff/bd149e81d80291a16d4d3968e68eb9f8#file-wc-exclude-product-category-from-shop-page-php
*
*/
function prefix_custom_pre_get_posts_query( $q ) {
if( is_shop() || is_page(‘shop’) ) { // set conditions here
$tax_query = (array) $q->get( ‘tax_query’ );
$tax_query[] = array(
‘taxonomy’ => ‘product_cat’,
‘field’ => ‘slug’,
‘terms’ => array( ‘musthave’ ), // set product categories here
‘operator’ => ‘NOT IN’
);
$q->set( ‘tax_query’, $tax_query );
}
}
Here is the main Shop Page and the item that I DONT want there is the purple one named “Mika Bunch”: https://146.66.97.212/~micajita/shop/
I want that item here: https://146.66.97.212/~micajita/product-category/prods/
It appears where I want it to, but I dont want it to appear on main shop page.
Any idea?
Thanks!
-Christina Mika
]]>But, that item is appearing at the main shop page (where the affiliate links are). How to hide it from there and only show it at its link?
Ive found the following code which I have NO IDEA where to put it or if I should put it or even what it does, but I searched first on the forum and found a question very similar to mine. This was the solution. Do you think its a good solution for me? If so, what do I do with it?
Here is the main Shop Page and the item that I DONT want there is the purple one named “Mika Bunch”: https://146.66.97.212/~micajita/shop/
I want that item here: https://146.66.97.212/~micajita/product-category/prods/
It appears where I want it to, but I dont want it to appear on main shop page.
Any idea?
Thanks!
-Christina Mika
add_action( ‘woocommerce_product_query’, ‘prefix_custom_pre_get_posts_query’ );
/**
* Hide Product Cateories from targetted pages in WooCommerce
* @link https://gist.github.com/stuartduff/bd149e81d80291a16d4d3968e68eb9f8#file-wc-exclude-product-category-from-shop-page-php
*
*/
function prefix_custom_pre_get_posts_query( $q ) {
if( is_shop() || is_page(‘shop’) ) { // set conditions here
$tax_query = (array) $q->get( ‘tax_query’ );
$tax_query[] = array(
‘taxonomy’ => ‘product_cat’,
‘field’ => ‘slug’,
‘terms’ => array( ‘musthave’ ), // set product categories here
‘operator’ => ‘NOT IN’
);
$q->set( ‘tax_query’, $tax_query );
}
}