Skip to content

Instantly share code, notes, and snippets.

@psaikali
Created June 4, 2015 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psaikali/403a34a3c66fb5b557cc to your computer and use it in GitHub Desktop.
Save psaikali/403a34a3c66fb5b557cc to your computer and use it in GitHub Desktop.
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