Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
On ajoute deux champs de type text à l'onglet "Avancé" de la metabox produit WooCommerce
/*************************************************************************************************
* On ajoute 2 champs (post meta ou custom field) aux produits WC dans l'onglet "Avancé"
*************************************************************************************************/
function msk_add_loves_hates_fields_to_product() {
woocommerce_wp_text_input(
array(
'id' => 'loves',
'data_type' => 'decimal',
'label' => __('Loves', 'msk'),
'placeholder' => __('Amount of love', 'msk'),
'description' => __('Love this product has received.', 'msk'),
'desc_tip' => true
)
);
woocommerce_wp_text_input(
array(
'id' => 'hates',
'data_type' => 'decimal',
'label' => __('Hates', 'msk'),
'placeholder' => __('Amount of hate', 'msk'),
'description' => __('Hatred this product has received.', 'msk'),
'desc_tip' => true
)
);
}
add_action('woocommerce_product_options_advanced', 'msk_add_loves_hates_fields_to_product');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.