Digital experiences for all disciplines
New Landing › How can we help? › Atelier › Changing order and removing items from product summary.
New Landing › How can we help? › Atelier › Changing order and removing items from product summary.
- This topic has 16 replies, 7 voices, and was last updated 8 years by Kyle – SUPPORT.
-
Posted in: Atelier
-
September 11, 2015 at 10:46 pm #212442
Could somebody please explain how to change/reorder the woocommerce product attributes (Title/Price/Description), that are currently created through the
do_action( 'woocommerce_single_product_summary' );
call in content-single-product.php ?In theory these should all be adjustable with a few calls in functions.php to reorder/remove them with calls such as:
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); remove_action( 'woocommerce_single_product_summary', 'sf_product_share', 45 );
However, they have no effect.
I can add into the page with
add_action
commands towoocommerce_single_product_summary
, but not remove/re-order what is there.September 14, 2015 at 11:15 am #212659Hi
You would need to edit the content-single-product.php file
– Kyle
September 15, 2015 at 10:24 pm #213348Hi Kyle,
I had tried that, but call the woocommerce file about 1/2 way down, which controls half of the items posted.
<?php /** * woocommerce_single_product_summary hook * * @hooked woocommerce_template_single_title - 5 * @hooked woocommerce_template_single_price - 10 * @hooked woocommerce_template_single_excerpt - 20 * @hooked woocommerce_template_single_add_to_cart - 30 * @hooked woocommerce_template_single_meta - 40 * @hooked woocommerce_template_single_sharing - 50 */ do_action( 'woocommerce_single_product_summary' ); ?>
Deleting that one line of code removes everything south of the price from the product page.
(stock status, description, meta, sharing, etc… )The way the code is commented, it implies that all of these can be changed, removed, or re-ordered with standard remove_action calls in function.php …
However, having tried this, it doesn’t seem to work.I can add new actions to the woocommerce_single_product_summary, which will appear anywhere I like depending on the priority I give it, but I can’t remove the items as listed in the SwiftIdeas comments in that php file.
September 16, 2015 at 10:57 am #213501Hi,
This will not control the order of the items on the page as such, please open the file
content-single-product.php
.There you will see the standard:
1)
Title:
<h1><?php the_title(); ?></h1>
2
Price: Starts on Line 111 to Line 121.
You can reorder them within that file.
Thanks,
David.September 16, 2015 at 12:23 pm #213578Hi Dean,
I understand that, and had used that to get rid of the breadcrumbs and next/previous buttons above the title.
However, everything rendered beneath the price, is all done with the one call to ‘do_action’.
It’s all of those I’d like to re-oder or remove, and that doesn’t seem possible under the standard practice ‘remove_action’ command?
September 16, 2015 at 5:23 pm #213774Hi,
From what I read in this article below after you successfully remove them using the remove_action you need to add them again with different priorities(this will determine their order in the page).
Take a look at it. Hope it helps.
-Rui
September 16, 2015 at 5:43 pm #213784This reply has been marked as private.September 18, 2015 at 10:21 am #214417Hi,
The only hooks I can confirm I can remove are the “Add to cart” and “Meta”.
Within my child theme
functions.php
:remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
The title/price/rating/pagination and comments are above the action:
do_action( 'woocommerce_single_product_summary' );
withincontent-single-product.php
.It looks like the comments above the
do_action
need to be updated to reflect this.I’ll request a response from the developer so we can clarify this.
Thanks,
David.September 19, 2015 at 5:35 pm #214720Hi @mccaul
At the moment they are directly in the content-single-product.php file as David said. I’ll get this re-worked for the next feature release.
– Ed
September 30, 2015 at 3:48 pm #217618Hi Ed,
I was just wondering if the changes were implemented in the latest 1.74 release?
Many thanks,
September 30, 2015 at 4:15 pm #217629No – they are planned in for v1.80 however.
Thanks,
– Ed
September 30, 2015 at 4:42 pm #217643No problem. Thanks Ed
September 30, 2015 at 4:51 pm #217645No problem. Thanks Ed.
-RuiMay 23, 2016 at 4:53 am #269239Has this been updated? I wish to have my short product description below ‘add to cart’ and ‘variations’. Please advise. Thanks!
May 23, 2016 at 9:35 am #269277Hi
Yes it has, follow David’s instructions above
– Kyle
-
Posted in: Atelier
You must be logged in and have valid license to reply to this topic.