Tagged: ismael, SKU, woocommerce
-
AuthorPosts
-
May 6, 2017 at 4:29 am #788698
I’d like to add the SKU on Woocommerce product category pages like this: http://postimg.org/image/44zk5gq7j/
How can I do this?May 6, 2017 at 12:57 pm #788812Hey k593,
This is a good tutorial for adding the SKU to your Shop pages:
https://www.skyverge.com/blog/add-information-to-woocommerce-shop-page/Best regards,
Jordan ShannonMay 11, 2017 at 12:06 am #791388I’ve added the following code to functions.php, but it is still not working.
/**
* Adds product SKUs above the “Add to Cart” buttons
* Tutorial: http://www.skyverge.com/blog/add-information-to-woocommerce-shop-page/
**/
function skyverge_shop_display_skus() {global $product;
if ( $product->get_sku() ) {
echo ‘<div class=”product-meta”>SKU: ‘ . $product->get_sku() . ‘</div>’;
}
}
add_action( ‘woocommerce_after_shop_loop_item’, ‘skyverge_shop_display_skus’, 9 );May 11, 2017 at 12:20 am #791392Hi,
If a custom solution, WooCommerce does offer an official SKU Generator Plugin that should fit your needs as well.
Best regards,
Jordan ShannonMay 11, 2017 at 12:24 am #791393Hi,
Also, is there no SKU option available for you to enter in the product category itself?
Best regards,
Jordan ShannonMay 14, 2017 at 12:26 am #792840Hi Jordan,
I am able to create SKUs and don’t want them to be automatically generated. What I am looking for is to have the SKU display on the product category page. Right now it is just a thumbnail and title (I’ve hidden the price). I haven’t been able to find plugins and no PHP snippets have worked so far. Is there anything further that you could suggest?
May 15, 2017 at 6:27 am #793166Hi,
Please add this hook in the functions.php file:
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_after_shop_loop_item_sku_in_cart', 20, 1); function woocommerce_after_shop_loop_item_sku_in_cart( $template ) { global $product; $sku = $product->get_sku(); echo $sku; }
Best regards,
IsmaelMay 16, 2017 at 1:00 am #793635I added this code to my child theme functions.php file and it did not work, the same as all the other code I have tried. So I added it then directly to the main Enfold theme functions.php file and it worked. I’m not sure why the child theme didn’t work, but at least I have a solution now even if I need to repeat it for theme updates. Thank you for your help!
May 16, 2017 at 1:04 am #793638Hi,
I am glad you were able to find a solution, that is feasible for the moment. Perhaps if you contact WooCommerce plugin support directly they may have additional feedback as to why the code won’t work within the child function file.
Best regards,
Jordan ShannonJune 14, 2018 at 5:52 am #972616Ismael’s solution worked beautifully. However, I have two minor issues:
1) SKU is populating next to the price. How can I move it down one line break </br>?
2) How can I add the string/text “SKU: ” before it?Many thanks,
DarrellJune 14, 2018 at 6:20 am #972624Update: Found the solution to my posted issues here:
Apologies for the trouble. I love Enfold and the support team. Great product and people.
Cheers,
Darrell- This reply was modified 6 years, 6 months ago by Darrell.
June 14, 2018 at 4:27 pm #972883Hi Darrell,
Glad you got it working for you and thank you for sharing! :)
If you need further assistance please let us know.
Best regards,
VictoriaMarch 22, 2019 at 10:40 am #1081784Hi Guys,
Can you please give a update on this.. We all need to earch for the SKU in the Ajax Search. It should be not a problem for a PHP developer.
Teh solution isn´t working by ismael. Maybe not any more.
- This reply was modified 5 years, 9 months ago by Raphael.
March 25, 2019 at 3:47 am #1082486Hi,
@hunter75: Did you add the code in the functions.php file? That should render the sku right under the product title. Please make that html minification is disabled and purge the cache prior to checking the page.
Best regards,
IsmaelMarch 25, 2019 at 7:09 am #1082537If you don’t mind using a plugin for SKU search, this one works great in the Footer section of my site: https://logodancewear.com
I changed ‘SKU’ to ‘Style’, per the client’s request.
[IMG]http://i66.tinypic.com/2s8i61g.png[/IMG]March 25, 2019 at 7:33 pm #1082821Hi Darrell,
Thank you for your input.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.