Skip to content

Instantly share code, notes, and snippets.

@webdados
Created April 30, 2024 15:51
Show Gist options
  • Save webdados/26d4ca53852078e140bb925b72968f4f to your computer and use it in GitHub Desktop.
Save webdados/26d4ca53852078e140bb925b72968f4f to your computer and use it in GitHub Desktop.
Helper functions for the Simple Custom Fields for WooCommerce Blocks Checkout plugin
<?php
/**
* Usage example for the "Simple Custom Fields for WooCommerce Blocks Checkout" plugin helper functions
* Get it at https://ptwooplugins.com/product/simple-custom-fields-for-woocommerce-blocks-checkout/
*/
// Get "fiscal-number" field from the "Contact information" section, on orders and users
$value = swcbcf_get_order_field( $order_id, 'other', 'fiscal-number' );
$value = swcbcf_get_user_field( $user_id, 'other', 'fiscal-number' );
// Get "type-of-address" field from the "Addreses billing and shipping" section, on orders and users
$value = swcbcf_get_order_field( $order_id, 'billing', 'type-of-address' );
$value = swcbcf_get_order_field( $order_id, 'shipping', 'type-of-address' );
$value = swcbcf_get_user_field( 1, 'billing', 'type-of-address' );
$value = swcbcf_get_user_field( 1, 'shipping', 'type-of-address' );
// Get "register-for-the-newslet" field from the "Additional order information" section, on orders (these are not stored on users)
$value = swcbcf_get_order_field( $order_id, 'other', 'register-for-the-newslet' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment