Tagged: woocommerce
-
AuthorPosts
-
June 23, 2021 at 10:18 am #1307102
Hi
Iis there a possibility to move the position from “in stock” (“vorrätig” in german) AFTER the price?
Kindly Regards,
SoltnerJune 25, 2021 at 12:23 pm #1307427Hey soltner,
Thank you for the inquiry.
We checked the product page and it looks like the stock is now located after the price. Do you require more help with this? You can use the template hooks if you want to move certain elements in the product page.
Example:
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 10 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 30 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 40 );
Best regards,
IsmaelJune 25, 2021 at 2:56 pm #1307457Hello,
sorry but I had sent the wrong reference page – see in private content.
I tried the hooks, but unfortunately didn’t manage to set the stock-to-stock according to the price.
is there a possibility?Kindly Regards,
SoltnerJune 28, 2021 at 9:11 am #1307684Hi,
Thank you for the update.
Try to add this code in the functions.php file to display the stock after the price.
add_action("woocommerce_single_product_summary", function() { global $product; echo wc_get_stock_html( $product ); // WPCS: XSS ok. }, 15);
You may need to remove or hide the default “in stock” element using css.
Best regards,
IsmaelJuly 2, 2021 at 10:29 am #1308483Hi,
great, it works!
I try to hide the defalut “in stock” with this code:p.stock.in-stock {
display: none!important;
}but unfortunately both are hidden… can you please help me here too?
Best regards,
SoltnerJuly 3, 2021 at 8:51 am #1308571Hi,
Thanks for the update. Please try this CSS instead:
.single-product p.in-stock:nth-child(2) { display: none; }
Best regards,
RikardJuly 10, 2021 at 9:53 am #1309485Hi Rikard,
sorry for my late reply… i try the css but is not working (i try also with !important!).
Kindly regards,
SoltnerJuly 12, 2021 at 3:50 am #1309636Hi,
Thanks for the update. Please try this CSS instead:
.single-product p.in-stock:nth-of-type(2) { display: none; }
Best regards,
RikardJuly 19, 2021 at 10:32 am #1310698Hi Rikard,
sorry for the late reply again, but I only got back from vacation yesterday :-)
Thank you for your feedback! I tried the code, but the upper “in stock” is hidden, but I would like to hide the lower one, is that also possible?
See also screenshot in private…Best regards,
SoltnerJuly 20, 2021 at 4:58 am #1310808Hi,
Thanks for the update, I hope you had a good holiday :-)
Could you provide us with admin WordPress login details in private, so that we can try to adjust the CSS for you please?
Best regards,
RikardJuly 20, 2021 at 8:37 am #1310842Hi,
yes, was wonderful :-)
See WP login details in private – thank you so much for your help!
Best regards,
SoltnerJuly 21, 2021 at 5:26 am #1311009Hi,
Thanks for that. I couldn’t get any CSS to apply from Quick CSS or you style sheet in the child theme, but this works in the WordPress customiser. Please try it out:
.single-product p.in-stock:nth-of-type(3) { display: none; }
Best regards,
RikardJuly 21, 2021 at 8:01 am #1311051Hi,
Great :-)
Thank you very much, big compliments to the support!Best regards,
SoltnerJuly 22, 2021 at 7:53 am #1311360Hi,
Great, I’m glad that we could help you out :-)
Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
RikardJuly 22, 2021 at 8:40 am #1311372Thanks Rikard,
you can close the topic!
Best regards,
SoltnerJuly 23, 2021 at 11:15 am #1311798 -
AuthorPosts
- The topic ‘Woocommerce change position "in stock"’ is closed to new replies.