Skip to content

Instantly share code, notes, and snippets.

Mina Pansuriya MinaPansuriya

Block or report user

Report or block MinaPansuriya

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Wocommerce apply coupon automatically to the cart for specific products
/**
* @Title: Wocommerce apply coupon automatically to the cart for specific products
* @Author: Mina Pansuriya
* @Blog URL :http://minapansuriya.com/wocommerce-apply-coupon-automatically-to-the-cart-for-specific-products/
**/
add_action( 'woocommerce_before_cart', 'pbs_apply_auto_discount_coupons' );
function pbs_apply_auto_discount_coupons() {
global $woocommerce;
View WooCommerce - Add Bcc email to Completed Order Email
/**
* @Title: WooCommerce - Add Bcc email to Completed Order Email
* @Author: Mina Pansuriya
* @Blog URL: http://minapansuriya.com/woocommerce-add-bcc-email-to-completed-order-email/
**/
add_filter( 'woocommerce_email_headers', 'es_headers_filter_function', 10, 3);
function es_headers_filter_function( $headers, $id, $object )
{
View Woocommerce Add a product to the cart programmatically
/**
* @Title: Woocommerce Add a product to the cart programmatically
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
* @Blog URL: http://minapansuriya.com/woocommerce-add-a-product-to-the-cart-programmatically/
*/
add_action( 'template_redirect', 'pbs_woo_add_gift_product_to_the_cart' );
function pbs_woo_add_gift_product_to_the_cart() {
$isAddGiftF = false;
View WooCommerce - List All Products From a specific category
/**
* @Title: WooCommerce - List All Products From a specific category
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
* @Blog URL: http://minapansuriya.com/woocommerce-list-all-products-from-a-specific-category/
*/
<?php
$cat_name = 'Bags'; // Here replace Category name with yours
$product_cat = get_term_by( 'name', $cat_name, 'product_cat' );
$cat_slug = $product_cat->slug;
View Woocommerce - List All Categories
/**
* @Title: Woocommerce - List All Categories
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
* @Blog URL: http://minapansuriya.com/woocommerce-list-all-categories/
*/
<?php
$args = array(
'taxonomy' => 'product_cat',
'orderby' => 'name',
View WooCommerce - Set minimum amount for delivery of an order
/**
* @Title: WooCommerce - Set minimum amount for delivery of an order
* @Author: Mina Pansuriya
* @Blog URL: http://minapansuriya.com/woocommerce-set-minimum-amount-for-delivery-of-an-order/
add_action( 'woocommerce_check_cart_items', 'pbs_cart_check_for_min_order_amount', 99, 1 );
function pbs_cart_check_for_min_order_amount( ) {
global $woocommerce;
View WooCommerce - How to use Woocommerce Cart Widges on any page
/**
* @Title: WooCommerce - How to use Woocommerce Cart Widges on any page
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
<?php the_widget( 'WC_Widget_Cart'); ?>
View WooCommerce Display Price and Add to Cart button for specific user role only from Shop and Single Product pages
/**
* @Title: WooCommerce Display Price and Add to Cart button for specific user role only from Shop and Single Product pages
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
*/
if(is_user_logged_in() )
{
$current_user = wp_get_current_user();
foreach ( $current_user->roles as $role )
{
View WooCommerce Add Product Price Unit on Shop and Single Product Page
/**
* @Title: WooCommerce Add Product Price Unit on Shop and Single Product Page
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
*/
add_filter( 'woocommerce_get_price_html', 'pbs_woo_add_product_unit_after_prie' );
add_filter( 'woocommerce_cart_item_price', 'pbs_woo_add_product_unit_after_prie' );
function pbs_woo_add_product_unit_after_prie( $price ) {
View WooCommerce Show Custom Text on Shop page to non-logged in Customer
/**
* @Title: WooCommerce Show Custom Text on Shop page to non-logged in Customer* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
*/
add_action( 'woocommerce_archive_description', 'pbs_woo_product_archive_additiona_details', 20 );
function pbs_woo_product_archive_additiona_details( ){
if(! is_user_logged_in() )
{
You can’t perform that action at this time.