This file contains hidden or 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
<?php | |
// Admin side Variable product fields | |
add_action( 'woocommerce_product_after_variable_attributes', 'ci_variation_settings_fields', 10, 3 ); | |
// Save Variation Settings | |
add_action( 'woocommerce_save_product_variation', 'ci_save_variation_settings_fields', 10, 2 ); | |
// Create new fields for variations | |
function ci_variation_settings_fields( $loop, $variation_data, $variation ) { | |
// Text Field |
This file contains hidden or 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
<?php | |
/** | |
* Single variation display | |
* | |
* This is a javascript-based template for single variations (see https://codex.wordpress.org/Javascript_Reference/wp.template). | |
* The values will be dynamically replaced after selecting attributes. | |
* | |
* @see https://docs.woocommerce.com/document/template-structure/ | |
* @package WooCommerce/Templates | |
* @version 2.5.0 |
This file contains hidden or 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
<?php | |
// Add New Variation Settings | |
add_filter( 'woocommerce_available_variation', 'load_variation_settings_fields' ); | |
/** | |
* Add custom fields for variations | |
* | |
*/ | |
function load_variation_settings_fields( $variations ) { | |
// duplicate the line for each field |
This file contains hidden or 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
<?php | |
// Admin side Variable product fields | |
add_action( 'woocommerce_product_after_variable_attributes', 'ci_variation_settings_fields', 10, 3 ); | |
// Create new fields for variations | |
function ci_variation_settings_fields( $loop, $variation_data, $variation ) { | |
// Text Field | |
woocommerce_wp_text_input( | |
array( |
This file contains hidden or 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
<?php | |
//Complete Woocommerce custom product fields code | |
// Display Admin Fields | |
add_action( 'woocommerce_product_options_general_product_data', 'ci_custom_general_tab_fields' ); | |
// Save All Fields | |
add_action( 'woocommerce_process_product_meta', 'ci_custom_general_tab_fields_save' ); | |
function ci_custom_general_tab_fields() { |
This file contains hidden or 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
<?php | |
//Display custom fields on Woocommerce Product Details Page | |
add_action( 'woocommerce_single_product_summary', 'ci_woo_product_detail', 5 ); | |
function ci_woo_product_detail() { | |
global $product; | |
echo '<div>'; | |
echo '<span><strong> Text Field:</strong> ' . get_post_meta( $product->id, '_text_field', true ) . '</span>'; |
This file contains hidden or 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
<?php | |
// Save All Fields | |
add_action( 'woocommerce_process_product_meta', 'ci_custom_general_tab_fields_save' ); | |
//Saving Fields Values | |
function ci_custom_general_tab_fields_save( $post_id ){ | |
// Text Field | |
$woocommerce_text_field = $_POST['_text_field']; | |
if( !empty( $woocommerce_text_field ) ) |
This file contains hidden or 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
<?php | |
// Display product Fields | |
add_action( 'woocommerce_product_options_general_product_data', 'ci_custom_general_tab_fields' ); | |
function ci_custom_general_tab_fields() { | |
global $woocommerce, $post; | |
echo '<div class="options_group">'; | |
This file contains hidden or 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
<?php | |
woocommerce_wp_text_input( | |
array( | |
'id' => '_text_field', | |
'label' => __( 'Text Field', 'woocommerce' ), | |
'placeholder' => '', | |
'desc_tip' => 'true', | |
'description' => __( 'Enter text here.', 'woocommerce' ) | |
) |
This file contains hidden or 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
/* | |
flatsome [ux-countdown] shortcode usage | |
*/ | |
//Admin side shortcode | |
[ux_countdown year="2019" month="10" day="30" time="15:00"] | |
//Add below in functions.php | |
echo do_shortcode('[ux_countdown year="2019" month="10" day="30" time="15:00"]'); |
NewerOlder