Tagged: avia, shortcode, woocommerce
-
AuthorPosts
-
January 16, 2017 at 11:20 pm #734385
The shortcode
[wdm_my_subscription]
below loads the users WooCommerce Membership subscriptions to the frontend, if the user has any, otherwise the code produces a message that the user does not have any subscriptions. The shortcode produce the result on the page, but ignores the Avia Modules and thus loads the content above them, rendering the page erroneously (See screenshot) .This site uses other shortcodes, mainly from Gravity Forms, Gravity View, Avia page builder of cource plus one or two other minor functions. All of these work as expected. I have tried several other shortcodes that load data from WooCommerce “My account” page, and found that all of them produce the same error. I suppose it’s not a long shot to guess that the plausible reason is that the Avia Builder is not singing in perfect harmony with WooCommerce.
Would be happy for a lead or a hint on where a fix for this can be found.
Script for placement in functions.php:
function wmd_my_custom_function(){ add_filter('widget_text', 'do_shortcode'); WC_Subscriptions::get_my_subscriptions_template(); } add_shortcode('wdm_my_subscription', 'wmd_my_custom_function');
January 19, 2017 at 2:23 pm #735859Hey Björn,
Thank you for using Enfold.
Are you using the advance layout builder? Please provide the url to the page so that we can inspect the markup. Or replace the snippet with the following.
function wmd_my_custom_function(){ add_filter('widget_text', 'do_shortcode'); ob_start(); WC_Subscriptions::get_my_subscriptions_template(); $output = ob_get_clean(); return $output; } add_shortcode('wdm_my_subscription', 'wmd_my_custom_function');
Best regards,
IsmaelJanuary 23, 2017 at 2:31 pm #737255Yes I am using the advanced layout builder. The code you provided does the trick.
Thanks!January 24, 2017 at 6:06 am #737523 -
AuthorPosts
- You must be logged in to reply to this topic.