Pass custom Checkout field value to Stripe gateway in WooCommerce

You can use wc_stripe_payment_metadata dedicated filter hook to add (pass) some custom meta data to Stripe gateway, this way: add_filter( ‘wc_stripe_payment_metadata’, ‘stripe_payment_metadata_filter_callback’, 10, 3 ); function stripe_payment_metadata_filter_callback( $metadata, $order, $prepared_source ) { // Here below define your custom field meta key (as it’s saved in wp_postmeta DB table) $metadata=”custom_meta_key”; $metadata[ __( ‘Custom Label Text (or … Read more

Which WooCommerce hook do I need to use to place the coupon field after the checkout sidebar

There are some important things to point out that will help you get somewhere hopefully close. First, the coupon code entry is a form separate from the checkout form. You cannot place one form inside another as that would conflict the submission process (essentially, you’d be submitting the wrong data to the wrong handling process). … Read more

Changing Woocommerce price display [closed]

I found the hooks you were looking for by reviewing the WooCommerce template source code (review-order.php). Here’s the code: add_filter( ‘woocommerce_get_price_html’, ‘kd_custom_price_message’ ); add_filter( ‘woocommerce_cart_item_price’, ‘kd_custom_price_message’ ); add_filter( ‘woocommerce_cart_item_subtotal’, ‘kd_custom_price_message’ ); // added add_filter( ‘woocommerce_cart_subtotal’, ‘kd_custom_price_message’ ); // added add_filter( ‘woocommerce_cart_total’, ‘kd_custom_price_message’ ); // added function kd_custom_price_message( $price ) { $afterPriceSymbol=”.-“; return $price . $afterPriceSymbol; … Read more

woocommerce_before_calculate_totals in woocommerce 3.0

Well, the problem is you are calling price directly at $value[‘data’]->price. Make it $value[‘data’]->get_price() and I think you problem will be fixed. So the whole code block will be- function calculate_embossing_fee( $cart_object ) { if( !WC()->session->__isset( “reload_checkout” )) { /* Gift wrap price */ $additionalPrice = 5; foreach ( $cart_object->cart_contents as $key => $value ) … Read more

Woocommerce – How to add 5 stars to all products to test design

@Nikola‘s answer gives you what you want to need without saving anything to the database. If you need to save the values to the database and directly execute SQL, you can do the following. Basically WooCommerce stores product reviews data as a postmeta under meta keys _wc_rating_count _wc_average_rating _wc_review_count UPDATE fs_postmeta SET meta_value = 5 … Read more

How to hook on a WooCommerce checkout field?

There is no hook woocommerce_form_field, there is hook woocommerce_form_field_{$args[type]} (doc). $args[type] can be (look here for available options): text, checkbox, country, … Code below will wrap ‘billing_first_name‘ and ‘billing_last_name‘ fields in a wrapper like <div class=”first-and-second-field-wrapper”> […] </div>. function change_woocommerce_field_markup($field, $key, $args, $value) { $field = ‘<div class=”single-field-wrapper”>’.$field.'</div>’; if($key === ‘billing_first_name’) $field = ‘<div class=”first-and-second-field-wrapper”>’.$field; … Read more

Woocommerce: show default variation price is products list?

Try this code: add_filter(‘woocommerce_variable_price_html’, ‘custom_variation_price’, 10, 2); function custom_variation_price( $price, $product ) { $available_variations = $product->get_available_variations(); $selectedPrice=””; $dump = ”; foreach ( $available_variations as $variation ) { // $dump = $dump . ‘<pre>’ . var_export($variation[‘attributes’], true) . ‘</pre>’; $isDefVariation=false; foreach($product->get_default_attributes() as $key=>$val){ // $dump = $dump . ‘<pre>’ . var_export($key, true) . ‘</pre>’; // $dump … Read more