Forum Replies Created
-
AuthorPosts
-
Southernstarz2023
ParticipantHello,
Thanks so much for your help and for the code. I will let you know if I have any other questions!
Southernstarz2023
ParticipantHello, thank you for the resources and the code. I just tried all of the options you gave me and it is not working. The filters are still pulling in custom fields from products that are out of stock.
This is the code I tried to implement, I added the custom field to the ‘custom field name’ but should I be doing something different? Thanks! (I also tried it with both methods from the first link you sent about showing in-stock products only and neither worked)
`add_filter(‘asp_pre_get_front_filters’, ‘asp_change_a_filter’, 10, 2);
function asp_change_a_filter($filters, $type) {
$field = ‘winery’;
$exclude = array(‘value1’, ‘value2’);foreach ($filters as $k => $filter) {
if ( $filter->type() == ‘custom_field’ && $filter->data[‘field’] == $field ) {
$filter->remove($exclude);
}
}
return $filters;
}’Southernstarz2023
ParticipantHello, Okay thank you
Southernstarz2023
ParticipantOkay great thank you!
Southernstarz2023
ParticipantSure, that’s fine, thanks again
Southernstarz2023
ParticipantThat worked, thank you so much!!!
Southernstarz2023
ParticipantHello,
Thank you for the response. I tried including the custom tag in the inclusions settings but it did not work. I will have to try adding the custom text to the native Products widget.
Thanks, Phoebe
-
AuthorPosts