Myself Narender Singh Thakur ( NST ) and i share my Experience/Knowledge and Tricks for folks and beginners to solve their issues while making websites through this Planet.
Sometime we want to show the product publish date on product template.
Here is the code to show product created and publish date on product page.
1) product.published_at :- Returns the date and time the product was published.
2) product.created_at :- Returns the date and time the product was created
For example:- I want to show the NEW badge on product pages which one are published less than 15 days ago.
What is the purpose of body_class function in wordpress ?
body_class function helps to show the bunch of classes name to the body element that have information about what kind of page is currently being displayed.
Here is the way to implement body_class function into theme template.
<body <?php body_class(); ?>>
So now we want to add category name to body class .. mostly for styling purposes. 😉
Add this code to your functions.php file and hit on save button.
add_filter('body_class','nst_add_category_name'); function nst_add_category_name($classes) { if (is_single() ) { global $post; foreach((get_the_category($post->ID)) as $category) { // add category slug name to the $classes array $classes[] = $category->category_nicename; } } // return the $classes array here return $classes; }
Here is one of the way to Show Estimate Delivery Date and time of products on product page template under add to cart button in Shopify.
NOTICE : Please do only if you have little bit knowledge of files.. otherwise you can contact your developer or Just drop a message for me in chat box.
1. Login to your Shopify website admin and visit to Online Store Section and then Themes option.
2. Edit your theme by click on Edit Code option.
3. From left sidebar under Sections tab find product-template.liquid file.
3. Open product-template.liquid file and scroll to the end of form tag </form> .. like here..
So here are the way to apply manual discount automatically on checkout page.. if particular products are in cart items.
You can also use automatic discount for same purpose but if 1 automatic is already active then you can choose this 2nd way to apply auto discount.
As currently shopify plus support only one automatic discount at a time.
So here is the script you have to apply on cart liquid file of your theme. Mine is ( cart-template.liquid ) in Debut theme.
NOTE : Please create a normal discount in admin first then you can apply that code there in script.
Here is the way to add discount code in shopify….
Like in the above screenshot.. click on create discount button. New window will be like this..
Choose first one and next window will be..
Add your discount code there like helo or something you like or as per your purpose..
So we have now discount code name “helo” ..
add this script to near after form start.. on your theme cart liquid file. <form action=”/cart” method=”post”>
if you want to match single product in cart item then..
{% assign prod = false %}
{% for item in cart.items %}
{% if item.product.title == 'Your product name or title' %}
{% assign prod = true %}
{% endif %}
{% endfor %}
{% if prod %}
<input type="hidden" name="discount" value="helo"/>
{% endif %}
Please change “Your product name or title” to with your product name.
If you want to match two products then follow this script..
{% assign prod = false %}
{% assign prod1 = false %}
{% for item in cart.items %}
{% if item.product.title == 'Your product name or title' %}
{% assign prod = true %}
{% endif %}
{% if item.product.title == 'Your product name or title 2' %}
{% assign prod1 = true %}
{% endif %}
{% endfor %}
{% if prod and prod1 %}
<input type="hidden" name="discount" value="helo"/>
{% endif %}
So above scripts will only add discount on cart page if they matched to your mentioned products name and discount code will reflect on checkout page automatically.
You can also show message to cart page like this.. showing in red color on right side of screenshot.
add this one script to where you want to show message on cart page.
{% if prod and prod1 %}
<strong class="cod-check1">*Your discount will apply in checkout.</strong>
{% endif %}
I hope this will help you .. If you need more help then contact with me using chat box.
Here is the way to find the correct database used for your website..
Login to your website hosting and Click on File Manager.
Now find the file name wp-config.php and right click on that file to view it.
Now check your database name like here..
Now go to main homepage of your cpanel and click on phpMyAdmin icon.. like here..
Click on that and new window will open…like this .. so follow the steps i mentioned there… select the correct database to export and than click on “Export” 3 point top right.
After click on “Export”.. new window will be..
After Click on Go .. database will be downloaded to your machine .