Featured Product
Started by: CharlesB2907
in: Toolset Professional Support
Quick solution available
Problem:
Display woocommerce featured product using views.
Solution:
In order to do this you will need to use the following hook
add_filter( 'wpv_filter_query', 'featured_products',99,3 );
function featured_products( $query_args,$views_settings, $view_id) {
if ($view_id == 10){
$query_args = array(
'post_type' => 'product',
'tax_query' => array(
array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'featured',
'operator' => 'IN'
),
),
);
}
return $query_args;
}
Add the above to your functions.php file and then change the 10 to the id of your view. Once you have done this then you should be able to display your featured product.
2
28
5 years, 11 months ago
CharlesB2907
Allowing attribute selection on simple products
Started by: neilR
in: Toolset Professional Support
Quick solution available
Problem:
The issue here is that the user wanted to create a simple product in woocommerce with multiple attributes.
Solution:
It is not possible for a simple product to have attributes. I would recommend creating the product as a variable product.
https://docs.woocommerce.com/document/variable-product/
2
4
6 years ago
neilR