Asad
Forum Replies Created
-
i dont understand how should i select the default test location as it is already present in back end plzz reply me fast i am running out of time….
@arsalantariq can you please guide me some thing that i want to customize payment form of square is there any option available??
ok i have found problem it was
<?php wp_footer();?>i was missing in my custom theme wordpress site now it is working
sir console is blanck
and moreover i am using
<?php echo do_shortcode(‘[wpep-form id=”64″]’); ?>
in my theme checkout page kindly can yu rply fast i m running out of time.thanks
Forum: Fixing WordPress
In reply to: Need Help in Time Slot WordPresshttps://ww.wp.xz.cn/support/topic/need-help-in-time-slot-checking-in-wordpress/
this is the first problem i mentioned above problem:
i have created my wordpress website 4 months ago and the upper mentioned topic helped me alot
Forum: Fixing WordPress
In reply to: need help in time slot checking in wordpressHello Developers,
I am again stucking in a problem!!
i have created my wordpress website 4 months ago and the upper mentioned topic helped me alot
not my client turned out new senario:they are saying that in website user can not order from night(10:30 pm) to morning (9:00
am) Pakistan Standard Time.i used this following code:
function add_the_date_validation( $passed, $product_id, $quantity ) {
$passed = true;
date_default_timezone_set(“Asia/Karachi”);$day = date(‘l’);
$time = strtotime(date(‘h:i’));
$lunchstarttime_a = strtotime(“10:30”);
$lunchendtime_a = strtotime(“09:05”);$dinnerstarttime = strtotime(“10:30”);
$dinnerendtime = strtotime(“09:05”);//Check for Lunch
if($selected == “Lunch”)
{
if($time < $lunchstarttime_a && $time < $lunchendtime_a)
{$passed = false;
}
if(!$passed)
{
wc_add_notice( __( ‘SORRY! YOU CANNOT ORDER FOR LUNCH & DINNER IN BETWEEN 10:30 PM TO 9 AM DUE TO MEAL BOX OPERATIONAL HOURS.THANK YOU FOR YOUR PATIENCE!.’, ‘woocommerce’ ), ‘error’ );
}
}
}according to my senario any user/ customer should not order after 10:30 night and 9:05 morning
please help me we are running out of time
regards,
asadForum: Fixing WordPress
In reply to: need help for disabling hook or function for some products/categorythanks for this you save my day 😛
Forum: Fixing WordPress
In reply to: need help for disabling hook or function for some products/categoryplzz help me out i am facing this issue since last monday
thanks
Forum: Fixing WordPress
In reply to: need help for disabling hook or function for some products/category@sanzeeb3 i have already posted an issue:
https://ww.wp.xz.cn/support/topic/need-help-in-time-slot-checking-in-wordpress/
in which i am checking time slot for the foods to order means it should not add to cart lunch in between 12pm to 4:30pm and for dinner 4:30 pm to 9pm
i have use following function:
function add_the_date_validation( $passed, $product ) { date_default_timezone_set("Asia/Karachi"); $day = date('l'); $time = date("h:i a"); if(!empty($_POST['select-1614582561371'])) { $selected = $_POST['select-1614582561371']; $lunchstarttime = "12:05 pm"; $lunchendtime = "04:25 pm"; $dinnerstarttime = "04:30 PM"; $dinnerendtime = "11:20 PM"; //Check for Lunch if($selected == "Lunch") { if($time < $lunchstarttime && $time < $lunchendtime) { wc_add_notice( __( 'You can not order lunch between 12:00 AM to 04:30 PM', 'woocommerce' ), 'error' ); $passed = false; echo "false"; } } //Check for Dinner if($selected == "Dinner") { echo $time; if($time > $dinnerstarttime && $time < $dinnerendtime) { wc_add_notice( __( 'You can not order Dinner between 4:30 AM to 7 PM', 'woocommerce' ), 'error' ); $passed = false; } } return $passed; } else{ $passed = true; return $passed; } }and hook:
add_filter( ‘woocommerce_add_to_cart_validation’, ‘add_the_date_validation’, 10, 5 );and it is working fine but for some categories or foods products these limitations should be disabled as they can ordered any time and any where
so i found a little code:
// Avoid add to cart conditionally function avoid_add_to_cart_conditionally( $passed, $product_id, $quantity) { // HERE your product categories (can be IDs, slugs or names terms) $terms = array( 'weekily'); if( has_term( $terms, 'product_cat', $product_id ) ){ remove_filter( 'woocommerce_add_to_cart_validation', 'add_the_date_validation', 10, 5 ); $passed = true; } return $passed; }with hook:
add_filter( ‘woocommerce_add_to_cart_validation’, ‘avoid_add_to_cart_conditionally’, 20, 3 );
it is also working but unfortunately boht hooks are working
as:
add_filter( ‘woocommerce_add_to_cart_validation’, ‘avoid_add_to_cart_conditionally’, 20, 3 );
add_filter( ‘woocommerce_add_to_cart_validation’, ‘add_the_date_validation’, 10, 5 );and i know i am using “woocommerce_add_to_cart_validation” for both but dont know how could i achieve this
thanksForum: Fixing WordPress
In reply to: need help for disabling hook or function for some products/categoryso can you help me plzz more how can i put product id in it and how can i acehive this??
p.s.
i want to remove filter more then one product/categoriesthanks
regrads,