Skip to content

Instantly share code, notes, and snippets.

View fikryans's full-sized avatar

Fikriansyah fikryans

View GitHub Profile
@fikryans
fikryans / custom-checkout.php
Created November 19, 2020 12:23 — forked from yeriepiscesa/custom-checkout.php
WooCommerce custom checkout fields
<?php
class SolusiPress_Custom_Woo_Checkout {
public function __construct() {
add_filter( 'woocommerce_default_address_fields', array( $this, 'woo_address_fields' ), 50, 1 );
add_filter( 'woocommerce_checkout_fields', array( $this, 'woo_checkout_fields' ) );
// first & last name merge
add_filter( 'default_checkout_billing_first_name', array( $this, 'first_name_default_value' ), 10, 2 );
add_filter( 'default_checkout_shipping_first_name', array( $this, 'first_name_default_value' ), 10, 2 );
add_filter( 'woocommerce_checkout_posted_data', array( $this, 'checkout_full_name_posted_data' ), 11 );