hook-woocommerce

Woocommerce Mini Cart Widget Change Quantity

邮差的信 提交于 2019-12-11 17:47:51
问题 I've been researching and cannot find a solution to this. I am trying to add or remove items individually from the Default Woocommerce mini cart widget cart. Items are being added to the cart using AJAX. Currently, it's only possible to remove all quantities of the product. For example: If user adds 3 Shirt's to the cart, I want to allow the user to remove AND add 1 at a time instead of forcing them to remove the entire amount (all 3) at once. I have found that it's possible to add these

Change Woocommerce booking status on Custom Order Status change

故事扮演 提交于 2019-12-11 16:59:47
问题 I have some custom order statuses (made with WooCommerce Order Status Manager). But when I use a custom paid status, the booking status is not updated to "paid". I've cobbled together some code from various references but it results in a fatal error. Or maybe I am missing something where custom statuses are supposed to update the booking paid status without extra code? My code: add_action('woocommerce_order_status_pool-payment-rec','auto_change_booking_status_to_paid', 10, 1); function auto

WooCommerce login redirect based on cart and based on path

时光总嘲笑我的痴心妄想 提交于 2019-12-11 16:22:59
问题 I want these two cases, how can i achieve that User Checkout > Check login > if logged in checkout. if not Redirect to login/register page > proceed to the checkout page. After 2nd (From checkout page) point if customer want to go to my account then take them to My Account page if clicking on My Account link even if cart having items Scenario 2 if customer login directly without redirecting from any url > My Account Page have to show. How can i achieve that . I followed the above question but

display product description in my account orders table of Woocommerce

三世轮回 提交于 2019-12-11 15:26:45
问题 I want to display the description of the first item only next to the order id so if there is 3 items and all of them have descriptions i want it to show next to the order id the description of the first item only. Normally: #3214 What i expect: #3214 | Product Description 回答1: Add the follows code snippet in your active theme's functions.php to dothe above - function modify_woocommerce_order_number( $order_id, $order ) { if( !is_wc_endpoint_url( 'orders' ) ) return $order_id; $first_line_item

Disable shipping checkout fields for downloadable products in WooCommerce

不问归期 提交于 2019-12-11 15:08:49
问题 I know that I can automatically disable shipping fields by checking "virtual" on the product submission form, but how could I by default disable shipping fields for downloadable products on Woocommerce checkout section? 回答1: You can use the WC_Product conditional method is_downloadable() to target downloadable products in the following 2 cases: 1) Disable checkout shipping fields add_filter( 'woocommerce_cart_needs_shipping_address', 'filter_cart_needs_shipping_address_callback' ); function

Fatal error when Woocommerce custom field is triggered

血红的双手。 提交于 2019-12-11 14:09:25
问题 I have a custom field for woocommerce products. This field outputs an image in woocommerce emails. However, since I'm using Woocommerce Bookings (custom product type) plugin as well, upon confirmation of the booking, my site crashes down. This is the code that output custom field: //adds image to header add_action('woocommerce_email_header', 'wcv_ingredients_email_logo', 10, 2); function wcv_ingredients_email_logo( $email_heading, $email ){ if($email->object){ foreach($email->object->get

Get ACF custom fields values in woocommerce custom email notification

南楼画角 提交于 2019-12-11 13:49:54
问题 If the user Woocommerce changes his data, a mail to the administrator receives a email about these changes. I need to show in this letter the custom fields that I created in the ACF. (In ACF created a questionnaire and put it into a /edit-account) Here is the complete code, based on - Send notification email when customer changes address WooCommerce if( !class_exists('WooCommerceNotifyChanges') ){ class WooCommerceNotifyChanges{ function __construct(){ // customer saves main account data add

filter woocommerce cancel unpaid order

牧云@^-^@ 提交于 2019-12-11 09:24:14
问题 i want to ask how to overwrite this woocommerce function (wp_schedule_single_event and post_status) using filter/action Plugin file location : /woocommerce/includes/wc-order-functions.php Original File : /** * Cancel all unpaid orders after held duration to prevent stock lock for those products. * * @access public */ function wc_cancel_unpaid_orders() { global $wpdb; $held_duration = get_option( 'woocommerce_hold_stock_minutes' ); if ( $held_duration < 1 || get_option( 'woocommerce_manage

Set a custom calculated price in Woocommerce Before Calculate Totals hook

99封情书 提交于 2019-12-11 08:34:08
问题 So I have setup woocommerce with Advance Seat Reservation Management for WooCommerce plugin but I'm running into pricing issues as the Minicart widget shows the item price divided by 2. Appreciate any help. Here is the related involved plugin code: add_action( 'woocommerce_before_calculate_totals', 'srw_add_custom_price' ); function srw_add_custom_price( $cart_object ){ global $wpdb; foreach( $cart_object->cart_contents as $key => $value ){ $proId = $value['data']->id; if(isset($_SESSION[

Woocommerce product custom price is not accepted by woocommerce coupon

丶灬走出姿态 提交于 2019-12-11 07:37:34
问题 In our woocommerce shop , customer can enter the custom width and height of the product and product price calculated based on this details . For example if the initial price for a product is 50 . And customer add width =2, height=3 , then the price for this product is going to 50*2*3=300 for this we are using following code // Save custom field value in cart item as custom data add_filter( 'woocommerce_add_cart_item', 'calculate_custom_cart_item_prices', 30, 3 ); function calculate_custom