{"id":3073,"date":"2014-07-03T02:13:21","date_gmt":"2014-07-03T02:13:21","guid":{"rendered":"http:\/\/www.tipsandtricks-hq.com\/ecommerce\/?p=3073"},"modified":"2024-01-19T19:50:10","modified_gmt":"2024-01-19T08:50:10","slug":"adding-shopping-cart-to-the-sidebar-of-wordpress-site","status":"publish","type":"post","link":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/adding-shopping-cart-to-the-sidebar-of-wordpress-site-3073","title":{"rendered":"Adding a Shopping Cart to The Sidebar of Your WordPress site"},"content":{"rendered":"<p>Use the following steps to add a shopping cart to the sidebar of your WordPress site. This will allow your customers to see what items they have in their cart when browsing and adding items to the cart.<\/p>\n<h2>Steps to Add a Sidebar Shopping Cart<\/h2>\n<p><strong>Step 1)<\/strong> Go to the widgets menu of your WordPress admin dashboard area.<\/p>\n<p><strong>Step 2)<\/strong> Add a standard text widget to the sidebar of your site. Your theme need to support sidebars.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3077\" src=\"http:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-content\/uploads\/2014\/07\/adding-a-sidebar-cart-widget.png\" alt=\"adding-a-sidebar-cart-widget\" width=\"350\" height=\"299\" srcset=\"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-content\/uploads\/2014\/07\/adding-a-sidebar-cart-widget.png 350w, https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-content\/uploads\/2014\/07\/adding-a-sidebar-cart-widget-300x256.png 300w\" sizes=\"(max-width: 350px) 100vw, 350px\" \/><\/p>\n<p><strong>Step 3)<\/strong> Use one of the following shortcodes to add the cart in this sidebar widget:<\/p>\n<pre>[show_wp_shopping_cart]\n<\/pre>\n<p>or<\/p>\n<pre>[always_show_wp_shopping_cart]\n<\/pre>\n<p>The first shortcode will only show the cart if there are any items in the cart. The 2nd one will always show the cart (even if the cart is empty).<\/p>\n<p>Try them both and use the one that you like.<\/p>\n<p>Below is an exmaple of how the cart should look on the sidebar:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3078\" src=\"http:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-content\/uploads\/2014\/07\/how-the-cart-looks-on-the-sidebar.jpg\" alt=\"how-the-cart-looks-on-the-sidebar\" width=\"500\" height=\"381\" srcset=\"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-content\/uploads\/2014\/07\/how-the-cart-looks-on-the-sidebar.jpg 500w, https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-content\/uploads\/2014\/07\/how-the-cart-looks-on-the-sidebar-300x228.jpg 300w, https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-content\/uploads\/2014\/07\/how-the-cart-looks-on-the-sidebar-264x200.jpg 264w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/p>\n<h2>Adding the Cart to the Sidebar via a Template File<\/h2>\n<p>If you are a developer and you are trying to add the cart to the sidebar from your theme&#8217;s template file then use the following PHP function:<\/p>\n<pre>&lt;?php echo print_wp_shopping_cart(); ?&gt;\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Use the following steps to add a shopping cart to the sidebar of your WordPress site. This will allow your customers to see what items they have in their cart when browsing and adding items to the cart. Steps to Add a Sidebar Shopping Cart Step 1) Go to the widgets menu of your WordPress [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[34],"tags":[178,173,32],"class_list":{"0":"post-3073","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-additional-guidance","7":"tag-cart-shortcode","8":"tag-e-commerce","9":"tag-wp-shopping-cart","10":"entry"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/posts\/3073"}],"collection":[{"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/comments?post=3073"}],"version-history":[{"count":0,"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/posts\/3073\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/media?parent=3073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/categories?post=3073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/tags?post=3073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}