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
<?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 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 | |
//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
//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 | |
//display data in cart item table | |
function display_data_in_cart_item_table( $product_name, $cart_item, $cart_item_key ) { | |
$categories = wc_get_product_category_list( $cart_item['product_id']); | |
$product_sku = get_post_meta($cart_item['product_id'] , '_sku', true); | |
$product_name = $product_name . '<dl style="border:2px solid red;padding:10px;"> | |
<dt>Category : </dt> |
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 product detail page text after excerpt | |
function display_after_short_description($excerpt) { | |
$add_to_excerpt = $excerpt . "<p style='color:green'>Add anything after excerpt</p>"; | |
return $add_to_excerpt; | |
} |
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 display text after product detail page image, if product is on sale | |
function display_flatsome_after_product_images() { | |
global $product; | |
if ( $product->is_on_sale() ) | |
{ | |
echo '<div style="color:red; border:1px solid #ccc;">Limited time offer</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 | |
//flatsome on_sale product custom text | |
function display_text_product_box_after() { | |
global $product; | |
if ( $product->is_on_sale() ) | |
{ | |
echo '<b style="color:red">Limited time offer</b>'; | |
} |