Created
April 22, 2022 07:56
-
-
Save bradleysa/2e3915dfb19dd5ce94034e6c45a00af6 to your computer and use it in GitHub Desktop.
WC: Add attributes to checkout fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add attributes to checkout fields | |
function wc_add_checkout_add_ons_attributes( $checkout_fields ) { | |
$add_on_id = 2; // change number to correct add-on id | |
if ( isset( $checkout_fields['add_ons'][ 'wc_checkout_add_ons_' . $add_on_id ] ) ) { | |
$checkout_fields['add_ons'][ 'wc_checkout_add_ons_' . $add_on_id ]['placeholder'] = "Add a short message for a handwritten card (optional)"; | |
//Adds placeholder text | |
} | |
return $checkout_fields; | |
} | |
add_filter( 'woocommerce_checkout_fields', 'wc_add_checkout_add_ons_attributes', 20 ); | |
/** http://docs.woothemes.com/document/woocommerce-checkout-add-ons-developer-docs/ **/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment