-
AuthorPosts
-
March 28, 2019 at 7:16 pm #1084230
So we are trying various plugins for having a product variations table on single product page in Woocommerce.
The plugins are supposed to display these tables below the quick description/price and above the product description/more info.However in Enfold these tables gets added BELOW product description/more info.
I have tried switching themes and everything works as it should but not in Enfold.
This is an example of a plugin we want to use:Provided URL to our site with the plugin mentioned above installed.
I think some quick custom PHP is needed in order to hook this in the default location, above the product description/more info.
April 1, 2019 at 6:49 pm #1085659Hey,
Please try adding following code to bottom of functions.php file in Appearance > Editor
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 1 ); add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
Best regards,
YigitApril 1, 2019 at 10:24 pm #1085723Thanks for your reply. The code worked ok for our pages with a product variations table.
However, now we have a problem with all other Woocommerce product pages that are not using a product variations table.More info in private content
April 5, 2019 at 4:46 am #1087340Hi,
Thanks for the update.
You have to check if the current product is of variable type, so this code adjustment should work.
add_action('after_setup_theme', 'ava_move_product_elements'); function ava_move_product_elements() { global $product; if ( $product->is_type( 'variable' ) ) { remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 1 ); add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 ); } return false; }
Best regards,
IsmaelApril 5, 2019 at 6:02 pm #1087546I tried adding the code at the bottom of functions.php (First I removed the 2 lines of code from Yigit, mentioned earlier in this thread)
But I get the following error message (and wordpress refuse to save the file):Uncaught Error: Call to a member function is_type() on null in wp-content/themes/enfold/functions.php:745
Stack trace:
#0 [internal function]: ava_move_product_elements(”)
#1 wp-includes/class-wp-hook.php(286): call_user_func_array(‘ava_move_produc…’, Array)
#2 wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#3 wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#4 wp-settings.php(434): do_action(‘after_setup_the…’)
#5 wp-config.php(184): require_once(‘/nas/content/st…’)
#6 wp-load.php(37): require_once(‘/nas/content/st…’)
#7 wp-admin/admin.php(31): require_once(‘/nas/content/st…’)
#8 wp-admin/theme-editor.php(10): require_once(‘/nas/content/st…’)
#9 {main}
thrown- This reply was modified 5 years, 8 months ago by belinger.
April 8, 2019 at 4:20 am #1088115Hi,
Thanks for the update.
Try to replace this line:
global $product;
.. with:
$product = wc_get_product( get_the_ID() );
Or post the login details in the private field so that we can test it. Make sure that the Appearance > Editor panel is accessible.
Best regards,
IsmaelApril 10, 2019 at 8:15 pm #1089249Thanks for the reply, but I got the same error.
Log in details in private contentApril 12, 2019 at 1:11 am #1089796Hi,
We adjusted the code but then we can get the same error as posted above. Please post the FTP details in the private field so that we can remove the filter. Sorry for the inconvenience.
Best regards,
IsmaelApril 12, 2019 at 6:52 pm #1090128Provided login details in private content
April 15, 2019 at 3:20 am #1090808Hi,
Thanks for the update.
We used a different hook and added the “wc_get_product” function to fetch the product. The code is in the functions.php file.
add_action('wp', 'ava_move_product_elements'); function ava_move_product_elements() { $product = wc_get_product( get_the_ID() ); if ( $product->is_type( 'variable' ) ) { remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 1 ); add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 ); } return false; }
You may need to remove the previous custom function that we added in the plugin from your database.
Best regards,
IsmaelApril 17, 2019 at 4:29 pm #1092062Thanks again for trying to help, but did you even have a look at our website?
Its inaccessible displaying a long error msg all over the site.
Provided details in private content- This reply was modified 5 years, 8 months ago by belinger.
April 19, 2019 at 2:13 am #1092526Hi,
We don’t see that error in the product pages. Please remove the browser’s cache, then try again. (see private field)
Best regards,
IsmaelApril 25, 2019 at 8:17 pm #1094537This reply has been marked as private.April 29, 2019 at 4:06 am #1095157 -
AuthorPosts
- You must be logged in to reply to this topic.