Оформление заказа

Disable billing fields in woocommerce checkout (Gutenberg blocks)

add_filter( ‘woocommerce_get_country_locale’, function ( $locale ) { $cart = WC()->cart; // Only remove fields if we have a cart. if ( ! $cart ) { return $locale; } // If cart requires shipping, then it’s likely paid and isn’t calculated yet. if ( $cart->needs_shipping() ) { return $locale; } // Only remove fields if the […]

Disable billing fields in woocommerce checkout (Gutenberg blocks) Читать далее »

Send email to customer when woocommerce order status changed

add_action(«woocommerce_order_status_changed», «my_awesome_publication_notification»); function my_awesome_publication_notification($order_id, $checkout=null) { global $woocommerce; $order = new WC_Order( $order_id ); if($order->status === ‘completed’ ) { // Create a mailer $mailer = $woocommerce->mailer(); $message_body = __( ‘Your track number:’ . $order->get_billing_company() ); $message = $mailer->wrap_message( // Message head and message body. sprintf( __( ‘Order %s received’ ), $order->get_order_number() ), $message_body ); //

Send email to customer when woocommerce order status changed Читать далее »

Get payment gateway data saved in Woocommerce payment settings

// HERE define you payment gateway ID (from $this->id in your plugin code) $payment_gateway_id = ‘bacs’; // Get an instance of the WC_Payment_Gateways object $payment_gateways = WC_Payment_Gateways::instance(); // Get the desired WC_Payment_Gateway object $payment_gateway = $payment_gateways->payment_gateways()[$payment_gateway_id]; // Display saved Settings example: echo ‘<p>Title: ‘ . $payment_gateway->title . ‘</p>’; echo ‘<p>Description: ‘ . $payment_gateway->description . ‘</p>’;

Get payment gateway data saved in Woocommerce payment settings Читать далее »

Disable Payment Method for Specific products Category / Вимкнути спосіб оплати для певної категорії продуктів

add_filter( ‘woocommerce_available_payment_gateways’, ‘bbloomer_unset_gateway_by_category’ ); function bbloomer_unset_gateway_by_category( $available_gateways ) { if ( is_admin() ) return $available_gateways; if ( ! is_checkout() ) return $available_gateways; $unset = false; $category_id = 8; // TARGET CATEGORY foreach ( WC()->cart->get_cart_contents() as $key => $values ) { $terms = get_the_terms( $values[‘product_id’], ‘product_cat’ ); foreach ( $terms as $term ) { if (

Disable Payment Method for Specific products Category / Вимкнути спосіб оплати для певної категорії продуктів Читать далее »

Automatic manage stock and backorders notify woocommerce products

/* backorder text on single product page */ function so_42345940_backorder_message( $text, $product ){ if ( $product->managing_stock() && $product->is_on_backorder( 1 ) ) { $text = __( ‘Даний товар можливо замовити, термін доставки 12-22 дні. ‘, ‘your-textdomain’ ); } return $text; } add_filter( ‘woocommerce_get_availability_text’, ‘so_42345940_backorder_message’, 10, 2 ); /*different backorder text on single product page for dif

Automatic manage stock and backorders notify woocommerce products Читать далее »

Add different fees to checkout

$order->set_date_created($creation_tsz); $order->set_address( $address, ‘billing’ ); $order->set_address( $address, ‘shipping’ ); $order->set_currency(‘GBP’); ## ————- ADD FEE PROCESS —————- ## // Get the customer country code $country_code = $order->get_shipping_country(); // Set the array for tax calculations $calculate_tax_for = array( ‘country’ => $country_code, ‘state’ => », ‘postcode’ => », ‘city’ => » ); // Get a new instance of

Add different fees to checkout Читать далее »

Прокрутить вверх