Farhad Fariborzi
Forum Replies Created
-
Resolved…. Thank you Dear Dara
Yes, it worked this time: My mistake was that I didn’t understand your instructions correctly and instead of Filter Query ID, I inserted the value in the Filter ID field in the code you provided. After your re-instructions, the code still didn’t work. Only a small change was required in the widget settings, which was to enable the option: Include Loop Grid Query ID (because I used a loop to display the product grid) & with this change, your code worked perfectly and accurately. Thank you for your quick response and also the great guidance you provided.
add_filter( ‘bpfwe/get_terms_args/filter-078eb68’, function( $args, $widget ) {
if ( empty( $args[‘taxonomy’] ) ) return $args;$taxonomy = $args['taxonomy']; $terms = get_terms( array( 'taxonomy' => $taxonomy, 'hide_empty' => false, 'fields' => 'ids', ) ); $in_stock_terms = array(); foreach ( $terms as $term_id ) { $products = wc_get_products( array( 'status' => 'publish', 'stock_status'=> 'instock', 'limit' => 1, 'tax_query' => array( array( 'taxonomy' => $taxonomy, 'field' => 'term_id', 'terms' => $term_id, ), ), 'return' => 'ids', ) ); if ( ! empty( $products ) ) { $in_stock_terms[] = $term_id; } } $args['include'] = $in_stock_terms ?: array( 0 ); return $args;}, 10, 2 );
Hi Dear Dara> The code did not work
add_filter( 'bpfwe/get_terms_args/my_filter', function( $args, $widget ) { if ( empty( $args['taxonomy'] ) ) return $args; $taxonomy = $args['taxonomy']; $terms = get_terms( array( 'taxonomy' => $taxonomy, 'hide_empty' => false, 'fields' => 'ids', ) ); $in_stock_terms = array(); foreach ( $terms as $term_id ) { $products = wc_get_products( array( 'status' => 'publish', 'stock_status'=> 'instock', 'limit' => 1, 'tax_query' => array( array( 'taxonomy' => $taxonomy, 'field' => 'term_id', 'terms' => $term_id, ), ), 'return' => 'ids', ) ); if ( ! empty( $products ) ) { $in_stock_terms[] = $term_id; } } $args['include'] = $in_stock_terms ?: array( 0 ); return $args; }, 10, 2 );You said: the counts reflect how many products are linked to a term, not how many are currently in stock> Please test wordpress deafaul widget (… layerd novigation)، It seems that this widget works with the same logic as your plugin, but when displaying terms, it also takes into account inventory and hides terms that do not have any inventory. Also, when displaying the number of products, it only counts and displays those that have inventory in that term. In Your great plugin when the default filter is set as follows: Filter Type : custom field …. meta key: (_stock_status) …. meta value: instock In this case, after the user selects the term and the filter is applied, this will be taken into account and products that are out of stock for the selected term will not be displayed (Very correct and excellent way of doing things)).
Let me also say this: I have created the store page with Elementor loop and a dedicated template for the loop item. I tried several popular plugins for filtering products, but they had problems with the product grid loop built with it. However, your plugin, with the correct setting in the Post Widget Target section, is well compatible with the product grid loop built with it and the loop gird, and it works well and filters.
I forgot to mention that the above happens even when Display Empty Terms is turned off.
I installed and checked the plugin, unfortunately, it seems that there is no option on the product page to select pre-made size charts, and it seems that the only way to insert the size chart is to use its short code.
The yith size chart plugin has such a possibility and the possibility that I said in the first message (general shortcode). If this plugin has such a possibility, it will be great and it will be a great alternative to the YITH plugin, and of course, the great advantage of this plugin is that it is free
Forum: Plugins
In reply to: [Advanced Shipment Tracking for WooCommerce] track button redirectingI’m sorry, I am new to using this plugin. Am I right in thinking that track button should redirect to tracking URL ?
Forum: Plugins
In reply to: [Advanced Shipment Tracking for WooCommerce] track button redirectingOn my site, the latest orders are displayed in the dashboard (image 1) and all orders are displayed on the orders page (image 2)
In each of the mentioned pages, if you click on the track button, it will be redirected to the same page, but in the new tab.Track button in my account/ dashboard it`s redirected to my account/ dashboard (same page but in the new tab) instead of the tracking URL.
Track button in my account/orders it`s redirected to my account/ orders (same page but in the new tab) instead of the tracking URL.