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
//Copy flatsome theme file to child theme and add below code code to it. | |
themes/flatsome/woocommerce/cart/cart.php | |
Search this line <div class="col large-7 pb-0 <?php echo $main_classes; ?>"> | |
and replace it with <div class="col large-12 pb-0 <?php echo $main_classes; ?>"> | |
Search this line <div class="cart-collaterals large-5 col pb-0"> | |
add replace it with below code | |
<div class="cart-collaterals large-7 col pb-0"><h2>My Custom stuff will be there</h2></div> |
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 | |
//reorder flatsome checkout page email field | |
function ci_woo_reorder_fields($fields) { | |
$fields['billing']['billing_email']['priority'] = 20; | |
return $fields; | |
} | |
add_filter('woocommerce_checkout_fields','ci_woo_reorder_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 | |
//flatsome theme display role after account user | |
function display_role_after_account_user() { | |
$user_id = get_current_user_id(); | |
$user_meta=get_userdata($user_id); | |
$user_roles=$user_meta->roles[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 | |
//flatsome theme customize accounts area | |
function add_flatsome_account_links() { | |
$label = "My Test Link"; | |
$endpoint = "test-endpoint"; | |
?> | |
<li class="<?php echo wc_get_account_menu_item_classes( $endpoint ); ?>"> | |
<a style="color: red" href="<?php echo esc_url( wc_get_account_endpoint_url( $endpoint ) ); ?>"><?php echo esc_html( $label ); ?></a> |
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 | |
/* | |
Flatsome Theme Product On-Sale End Counter | |
*/ | |
function display_onsale_product_counter() { | |
global $product; | |
if ( $product->is_on_sale() ) |
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"]'); |
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
<?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 | |
// 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 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>'; |