Custom code snippets not working after filter
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page pleaseIf you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
Quote from Pale on July 4, 2023, 20:46hey, I want to add custom code snippets to the woocommerce shop loop. This works as long as I not filter the products. When I use the filter the snippets are not working anymore. Info: I need to use ajax filter
Because of this problem I also cant use the slideout shortcode. Afer I filter the slideout is not showing anymore.
hey, I want to add custom code snippets to the woocommerce shop loop. This works as long as I not filter the products. When I use the filter the snippets are not working anymore. Info: I need to use ajax filter
Because of this problem I also cant use the slideout shortcode. Afer I filter the slideout is not showing anymore.
Quote from Pablo Borysenco on July 5, 2023, 11:59Hello
Please drop me exact link to the issue
Describe in more datail your custon code
Hello
Please drop me exact link to the issue
Describe in more datail your custon code
Quote from Pale on July 11, 2023, 15:00difloraplant.it/shop
my main problem is that I cant add anything to the shop page as soon as I filter, all of my changes disappear. I added some snippets to show a new badge next to the product image
I want to add the slideout shortcode because when I say place the slideout everywhere it also place it on mobile even when I say dont show on mobile!
But when I add the shortcode and i filter on the shoppage it slideout is gone. It somehow always load the default shop loop without my changes.
difloraplant.it/shop
my main problem is that I cant add anything to the shop page as soon as I filter, all of my changes disappear. I added some snippets to show a new badge next to the product image
I want to add the slideout shortcode because when I say place the slideout everywhere it also place it on mobile even when I say dont show on mobile!
But when I add the shortcode and i filter on the shoppage it slideout is gone. It somehow always load the default shop loop without my changes.
Quote from Pablo Borysenco on July 12, 2023, 09:50Hello
Please paste your license key here - https://share.pluginus.net/image/i20230222134241.png -> https://share.pluginus.net/image/i20230222134511.png
Try to disable ajax and do a test
Hello
Please paste your license key here - https://share.pluginus.net/image/i20230222134241.png -> https://share.pluginus.net/image/i20230222134511.png
Try to disable ajax and do a test
Quote from Pale on July 12, 2023, 15:34Yes it is working without ajax. But I need to use ajax.
Yes it is working without ajax. But I need to use ajax.
Quote from Pablo Borysenco on July 13, 2023, 10:28Hello
Ok! So you need to make customizations so that they work (are compatible) with ajax mode
This of course depends on the type of customization and where you insert your custom code.
Hello
Ok! So you need to make customizations so that they work (are compatible) with ajax mode
This of course depends on the type of customization and where you insert your custom code.
Quote from Pale on July 13, 2023, 11:26For exmaple I want to use this shortcode on the shop page: [woof_slideout image=/wp-content/uploads/2023/05/filter.png image_h=38 image_w=142 location=left speed=100 action=click offset=45px onloadslideout=false mobile_behavior=2 ][/woof_slideout]
but when I filter the slideout is gone
same for this code snippet:
// New badge for recent products
add_action( 'woocommerce_before_shop_loop_item', 'new_badge', 40 );function new_badge() {
$product = wc_get_product( get_the_ID() );
$newness_days = 30; // Number of days the badge is shown
$created = strtotime( $product->get_date_created() );
if ( ( time() - ( 60 * 60 * 24 * $newness_days ) ) < $created ) {
echo '<span class="new-badge onsale">' . esc_html__( 'NEW', 'woocommerce' ) . '</span>';
}
}
which adds a new badge to the products at front end shop page.
Please filter at my shop page then you will se it.
For exmaple I want to use this shortcode on the shop page: [woof_slideout image=/wp-content/uploads/2023/05/filter.png image_h=38 image_w=142 location=left speed=100 action=click offset=45px onloadslideout=false mobile_behavior=2 ][/woof_slideout]
but when I filter the slideout is gone
same for this code snippet:
// New badge for recent products
add_action( 'woocommerce_before_shop_loop_item', 'new_badge', 40 );
function new_badge() {
$product = wc_get_product( get_the_ID() );
$newness_days = 30; // Number of days the badge is shown
$created = strtotime( $product->get_date_created() );
if ( ( time() - ( 60 * 60 * 24 * $newness_days ) ) < $created ) {
echo '<span class="new-badge onsale">' . esc_html__( 'NEW', 'woocommerce' ) . '</span>';
}
}
which adds a new badge to the products at front end shop page.
Please filter at my shop page then you will se it.
Quote from Pablo Borysenco on July 13, 2023, 12:18
Please add exact link to the issue
Where did you put your custom code.
Please add exact link to the issue
Where did you put your custom code.
Quote from Pale on July 13, 2023, 12:52is this an automatic answer?
here is the link: difloraplant.it/shop
I put the shortcode to the shop page and the code snippet to an code snippet plugin.
is this an automatic answer?
here is the link: difloraplant.it/shop
I put the shortcode to the shop page and the code snippet to an code snippet plugin.
Quote from Pablo Borysenco on July 14, 2023, 11:22hello
the shop page and the code snippet to an code snippet plugin. -Ok! Please paste it in functions.php
but when I filter the slideout is gone - My test - https://c2n.me/4iWM6FH - slide out does not disappear, maybe I'm doing something wrong
hello
the shop page and the code snippet to an code snippet plugin. -Ok! Please paste it in functions.php
but when I filter the slideout is gone - My test - https://c2n.me/4iWM6FH - slide out does not disappear, maybe I'm doing something wrong
Quote from Pale on July 18, 2023, 16:06i cant create a child theme so I cant paste it in the functions.php, why is it not working with the snippet plugin?
The slideout is now working as it should
i cant create a child theme so I cant paste it in the functions.php, why is it not working with the snippet plugin?
The slideout is now working as it should
Quote from Pablo Borysenco on July 19, 2023, 12:21hello
This means that the snippet plugin does not work (is not compatible) with ajax mode. Why this third party plugin doesn't add snippets in Ajax mode, unfortunately I don't know, it has nothing to do with my plugin
hello
This means that the snippet plugin does not work (is not compatible) with ajax mode. Why this third party plugin doesn't add snippets in Ajax mode, unfortunately I don't know, it has nothing to do with my plugin
Quote from Pale on July 27, 2023, 16:39I tried the most popular snippet plugins and it does not work for both.
this is one snippet I am using but it dissapear when I filter in ajax mode:
// New badge for recent products
add_action( 'woocommerce_before_shop_loop_item', 'new_badge', 40 );function new_badge() {
$product = wc_get_product( get_the_ID() );
$newness_days = 30; // Number of days the badge is shown
$created = strtotime( $product->get_date_created() );
if ( ( time() - ( 60 * 60 * 24 * $newness_days ) ) < $created ) {
echo '<span class="new-badge onsale">' . esc_html__( 'NEW', 'woocommerce' ) . '</span>';
}
}
I tried the most popular snippet plugins and it does not work for both.
this is one snippet I am using but it dissapear when I filter in ajax mode:
// New badge for recent products
add_action( 'woocommerce_before_shop_loop_item', 'new_badge', 40 );
function new_badge() {
$product = wc_get_product( get_the_ID() );
$newness_days = 30; // Number of days the badge is shown
$created = strtotime( $product->get_date_created() );
if ( ( time() - ( 60 * 60 * 24 * $newness_days ) ) < $created ) {
echo '<span class="new-badge onsale">' . esc_html__( 'NEW', 'woocommerce' ) . '</span>';
}
}
Quote from Pablo Borysenco on July 28, 2023, 11:15Hello
Ok! I'll try to explain it differently: It doesn't matter which plugin will make the ajax request if the snippet plugin is not compatible with ajax
My plugin uses the current theme products template. and all the hooks of this template work.
If you are interested in knowing the reason for the technical side: I think the problem is that the ajax request in the WP is executed in the admin area (wp-admin url ). And these snippet plugins have code that prevents scripts from being executed on the side of the admin panel. An example:
if (is_admin()){
return false;
}
The solution for such situations can be to check if the current request is AJAX:
if (is_admin() && !wp_doing_ajax()) {
return false;
}
Hello
Ok! I'll try to explain it differently: It doesn't matter which plugin will make the ajax request if the snippet plugin is not compatible with ajax
My plugin uses the current theme products template. and all the hooks of this template work.
If you are interested in knowing the reason for the technical side: I think the problem is that the ajax request in the WP is executed in the admin area (wp-admin url ). And these snippet plugins have code that prevents scripts from being executed on the side of the admin panel. An example:
if (is_admin()){
return false;
}
The solution for such situations can be to check if the current request is AJAX:
if (is_admin() && !wp_doing_ajax()) {
return false;
}