Product Description
-
Hi
Is it possible to add the product description under the title on the wishlist page?
Thank you
-
Hi!
Do you have some knowledge about web development, hooks and child themes?
Hi
Thank you for getting back to me.
I’ve managed to work out how to do this.. but I have another quick question. Can the ‘add to wishlist’ button be added to the Essential Grid? If so, is there a shortcode I can use? I would like to display my products on the Essential Grid instead of the normal shopfront.
Thank you so much.
Add to theme this code:
add_shortcode('wishlist_button', function(){ global $product; global $wishlistPage; $productId = $product->get_ID(); $addUrl = premmerce_wishlist()->getAddPopupUrl($productId); if($wishlistPage){ return ''; } ob_start(); ?> <div data-ajax-inject="wishlist-link--<?= $productId; ?>" > <div class="wishlist-btn-wrap" > <?php if(premmerce_wishlist()->checkInWishlist($productId)): ?> <a class="button alt" rel="nofollow" href="<?php echo premmerce_wishlist()->getWishlistUrl(); ?>"> <?php _e('View Wishlists','premmerce-wishlist'); ?> </a> <?php else: ?> <button class="button alt" data-modal-wishlist="<?= $addUrl; ?>"> <?php _e('View Wishlists','premmerce-wishlist'); ?> </button> <?php endif; ?> </div> </div> <?php return ob_get_clean(); });After this you will be able to use shortcode [wishlist_button]. Its will be work only with product.
-
This reply was modified 7 years, 8 months ago by
Premmerce.
-
This reply was modified 7 years, 8 months ago by
Steven Stern (sterndata).
Hi
I tried the exact code but I’m getting the below error. Any ideas please? I tried it in my functions.php file in my child theme, and also in the Frontend.php file for the plugin. Thanks again
Fatal error: Uncaught Error: Call to a member function get_ID() on null in /home2/myname/mydomain.com/wp-content/themes/x-child/functions.php:84 Stack trace: #0 /home2/myname/mydomain.com/wp-includes/shortcodes.php(319): {closure}(”, ”, ‘wishlist_button’) #1 [internal function]: do_shortcode_tag(Array) #2 /home2/myname/mydomain.com/wp-includes/shortcodes.php(197): preg_replace_callback(‘/\\[(\\[?)(wishli…’, ‘do_shortcode_ta…’, ‘[wishlist_butto…’) #3 /home2/myname/mydomain.com/wp-content/plugins/essential-grid/includes/item-skin.class.php(4744): do_shortcode(‘[wishlist_butto…’) #4 /home2/myname/mydomain.com/wp-content/plugins/essential-grid/includes/item-skin.class.php(2115): Essential_Grid_Item_Skin->insert_layer(Array, false, true, ‘1’, 1) #5 /home2/myname/mydomain.com/wp-content/plugins/essential-grid/includes/item-skin.class.php(2010): Essential_Grid_Item_Skin->insert_masonry_layer(false, ”, false, ‘1’, 1) #6 /home2/myname/mydomain.com/wp-content/plugins/essential-grid/publ in /home2/myname/mydomain.com/wp-content/themes/x-child/functions.php on line 84
Please, try to trigger [wishlist_button] at the product, like this:
add_action('woocommerce_after_shop_loop_item', function (){ echo do_shortcode('[wishlist_button]'); }); -
This reply was modified 7 years, 8 months ago by
The topic ‘Product Description’ is closed to new replies.