Magento – Get Cart Info – Total items in cart, Cart total, Cart Url


Today i came across cart feature in magento where i wanted to have cart Url, Total cart items, Cart Total amounts. So, Please find below code for various options in cart in Magento.

1) Get Magento cart total amount

2) Get Magento  count of product

3) Magento Format Price with currency with backend settings

Real Time Example code: (Just Copy and Paste)



Magento Get media url in Static Block

Some times, While creating static block, You might require to add image along with content, So, Here are steps you can follo

1) Upload your images on /media/images folder (You can create your own folder as well)

2) Syntax to use media in static block


Magento Get Page Url – CMS, Cart page, Checkout Page

Very Commonly used feature during Magento Template Development is to set Website navigation. Every time we need to set dynamic page url from Magento Admin Panel no matter whether it is CMS page, Cart page, Checkout page OR My Account page itself.

1) Get Magento CMS page url using ID -

2) Get Magento Shopping Cart page url

3) Get Magento My Account ( user account) Page Url

4) Get Magento Home Page Url ( OR Base Url)

4) Get Magento Home Page Url ( OR Base Url)

5) If you want to use Page link in CMS page ( in Editor) User Below format of link


Magento – If Conditions for various page like Cart, CMS, Checkout

In my initial learning phase of magento development, I just learn more useful information, Which can be used in Every single project / Website you developed using Magento.

Check it is CMS Page

Check for cart page

To check if the cart is empty or not use

Check if is current Category page or Product page

WooCommerce Hide payment gatway based on Visitor’s country

Some times, You may have to make restriction on payment gateways based on Current Visitor’s country or State or City,
You can use any field value of checkout form to do restriction.

Below is the code you will require, Just put this code on your active theme’s function.php

Simple way to load Google Font in Genesis

Various fonts are available in google font library and All are Free to USE!
Steps are find your favorite font from here and place below code in your child theme’s function.php

Remove “Add New” link from custom post type

If you want to prevent your client to add new entry from custom post type. Then Below is code that you have to put in your active theme’s function.php