Hi guys! Continuing with the series of tutorials on programming WooCommerce theme, today I will guide you to the function Display products in the cart.
Specifically this article I will show instructions, delete 1 product from the cart and other miscellaneous functions.
This function nè
Display products in cart WooCommerce
To make it easier to visualize, I will show the code first then explain it for you to follow, you like where it shows up, then copy this code and paste it into place in the theme you are using.
We have the following code:
Explain a bit:
- global variable declaration, this variable is provided by woo nha
- cart-> get_cart ();?> Get the list of products in the cart, value $ items This returns as an array containing multiple elements of the products in the cart.
- Declare the link to delete products from the shopping cart
- I checked $ items if there are elements then run the loop and print it out, if not, the show will show "no products have been added to the shopping cart" home!
I just explained it in a long way but I don't know if you guys copy the code and use it, you don't need to care at all!
Use another way:
In addition to the above way of using code, we have a way to use widgets. By default, when modifying the woocommerce plugin, it also provided us with a wiget to retrieve the shopping cart information.
You go to: Admin -> interface -> widget will see the wiget engine name: Cart
You can use this widet and give similar results, to learn how to use and position using widgets, please see the article about this sidebar.
Today I showed you how to make a mini basket function. Hopefully with this little knowledge will help one part for you learn wordpress easier.
Do not forget to like the page and follow my next posts!
The post A guide to display products in a shopping cart WooCommerce appeared first on Blog Huy Kira.Read more :
- Hướng dẫn làm món thịt bò kho gừng sả ngon tuyệt
- HPNY 2020 - Stablehost Hosting Coupon 80% | Fun Learning Web-Sharing knowledge and IT resources
- Leverage in Forex - How to choose the right leverage
- Instructions for using the text reading feature on Foxit Reader - Knowledge sharing blog