Tagged: do_shortcode not working
-
AuthorPosts
-
October 26, 2023 at 2:45 pm #1423786
Hi there,
We are using the Enfold theme, and Wishlist and Compare from yith.
It’s working perfectly when logged in, but logged out, the do_shortcodes won’t work.
We do not have any caching plugins activated.
We are using the shortcodes in a product grid, and also in a slider, but as I said, they only work logged in. I can’t seem to understand why.
These are my snippets:
Grid:
#child-theme/woocommerce/content-product.php # (previous code) global $product; # ... ?> <div class="tag-wrapper"> <?php echo apply_filters( 'the_content',' [yith_compare_button] '); <?php # (rest of the code)
Slider: (same link, but (url)/shop-startseite/)
#child-theme/shortcodes/econsor_productslider.php, within the html() function of the custom shortcode # ... $html .= do_shortcode( '[yith_wcwl_add_to_wishlist product_id="' . $product->get_id() . '"]', false ); # ...
They both work perfectly logged in, but not logged out, so I guess it’s not an issue within the code itself.
Can you guys help me out here?
Thanks in advance!October 27, 2023 at 3:10 am #1423867Hey emilconsor,
Thank you for the inquiry.
It’s possible that adding items to a wishlist is limited to logged-in users or site members, which could be why the shortcode isn’t working when logged out. You may want to reach out to the plugin authors for clarification.
Best regards,
IsmaelOctober 27, 2023 at 12:16 pm #1423903Hey Ismael,
yes, it is possible, as you can see in the link below, just above the price, you can add the product to your wishlist – even logged out.
The shortcode there hooks into the single_product_summary action.October 29, 2023 at 2:58 pm #1424017Hi,
I notice that on your page you have this errorUncaught TypeError: $(...).wc_product_gallery is not a function
from your custom.js
I’m not sure if this error also occurs when logged in, perhaps this is related.
If this doesn’t help Please include an admin login in the Private Content area so we can examine further.Best regards,
MikeOctober 30, 2023 at 9:31 am #1424090Hi Mike,
the TypeError is also logged in, so it is not related.
I’ve included an admin login for you – thank you for your time!
Regards
October 30, 2023 at 10:10 am #1424096Hi,
Are you using this plugin?
// https://wordpress.org/plugins/yith-woocommerce-wishlist
Why are you manually adding shortcodes to the template? The plugin already provides an option to place the wishlist button above the image. You can find this option in the Settings > Add to Wishlist > Loop settings section. This option works correctly for the Product Grid and Product Slider elements.
Best regards,
IsmaelNovember 2, 2023 at 9:39 am #1424362Hi,
yes, this is the plugin.I’m adding shortcodes manually since the plugin doesn’t work for my custom product slider shortcode I’ve created. I’ve pasted my code into the private contents.
We don’t want to use the enfold slider, that’s why we built custom sliders with splide.November 2, 2023 at 4:03 pm #1424409Hi,
Thank you for the update.
We’ve reviewed the code, but we couldn’t see any reason why the shortcode wouldn’t work. It’s possible that the shortcode function includes logic that affects the visibility of the wishlist button for non-logged-in users. Have you tried reaching out to the plugin developer about this issue?
Best regards,
IsmaelNovember 2, 2023 at 5:18 pm #1424423Hi Ismael,
yes, I’ve written the plugin developer at the same time, just to be sure to find the issue.
I’ve noticed that the shortcodes are gettinge executed with parameters, which are the tipical issues when facing a caching problem, but we do not have a caching plugin activated, so I really don’t understand why.Do you have an idea?
November 3, 2023 at 2:40 am #1424458Hi,
We are not really sure what’s missing at this point because we are not familiar with the plugin. Please wait for the response from the plugin developers as they should have a better understanding of how the shortcode works.
Thank you for your patience.
Best regards,
IsmaelNovember 14, 2023 at 11:28 am #1425555Hi Ismael,
I noticed this page also not working properly (linked below) when not logged in OR without any parameters.
I’m really struggeling now, since this is normally a caching problem, but as I said, we do not have any caching plugins activated.On a 1:1 copy of the page, it works. I really don’t know what to do anymore.
Do you have another idea?
- This reply was modified 1 year, 1 month ago by emilconsor.
November 14, 2023 at 12:48 pm #1425568Edit: Somehow, by changing the URL, it is working now.
I really can’t explain this, but that did the trick somehow. Thanks for your time.November 15, 2023 at 5:29 am #1425645 -
AuthorPosts
- The topic ‘do_shortcode not working when logged out’ is closed to new replies.