Home › Forums › WoodMart support forum › Adding total sales to Product Archive Grid
Adding total sales to Product Archive Grid
- This topic has 7 replies, 2 voices, and was last updated 5 months, 4 weeks ago by
Hung Pham.
-
AuthorPosts
-
January 14, 2025 at 11:19 pm #629765
AmitParticipantHello,
How can I add Total Sales (Actual and also Random Fake) to my Product Archive grid?
Is there a built-in feature for this, or an alternative method using code or a plugin?
Image AttachedPlease advise.
Attachments:
You must be logged in to view attached files.January 15, 2025 at 2:31 pm #629932
Hung PhamKeymasterHi Amit,
Thanks for reaching to us.
Sorry but there is no such option in Theme Settings.
Best Regards,
January 15, 2025 at 10:02 pm #630069
AmitParticipantor an alternative method using code or a plugin?
January 15, 2025 at 10:23 pm #630071
AmitParticipantHello,
Could you please tell me:
If I enable the “Product Sold Counter for Single Product Page” setting,
what is the meta key name where the counter number is stored?Additionally, could you provide details about the database location where this information is saved?
ThanksJanuary 16, 2025 at 1:36 pm #630230
Hung PhamKeymasterHi Amit,
Try to Add the code below to the functions.php file in your child theme:
add_action('woocommerce_shop_loop_item_title', function () { global $product; if ( ! woodmart_get_opt( 'sold_counter_enabled' ) || ! $product ) { return; } $sales_count_data = XTS\Modules\Sold_Counter\Main::get_instance()->get_product_sales_count_data($product->get_id()); if ( empty( $sales_count_data ) ) { return; } woodmart_enqueue_inline_style( 'woo-mod-product-info' ); woodmart_enqueue_inline_style( 'woo-opt-sold-count' ); ?> <div class="wd-product-info wd-sold-count"> <span class="wd-info-icon"></span><span class="wd-info-number"><?php echo esc_html( $sales_count_data['wd_count_number'] ); // Must be in one line. ?></span> <span class="wd-info-msg"><?php echo esc_html( $sales_count_data['wd_count_msg'] ); ?></span> </div> <?php }, 100);
Best Regards
January 16, 2025 at 5:39 pm #630326
AmitParticipantHello,
Thank you very much, Hung.
I have one last request: I want to show “21 sales” instead of “21 items sold in the last 24 hours.”
Is there any way to change the text after the sales count?Thanks
January 16, 2025 at 10:39 pm #630408
AmitParticipantI have figured it out. Thank you for your support!
add_action('woocommerce_shop_loop_item_title', function () { global $product; if ( ! woodmart_get_opt( 'sold_counter_enabled' ) || ! $product ) { return; } $sales_count_data = XTS\Modules\Sold_Counter\Main::get_instance()->get_product_sales_count_data($product->get_id()); if ( empty( $sales_count_data ) ) { return; } woodmart_enqueue_inline_style( 'woo-mod-product-info' ); woodmart_enqueue_inline_style( 'woo-opt-sold-count' ); ?> <div class="wd-product-info wd-sold-count"> <span class="wd-info-icon"></span><span class="wd-info-number"><?php echo esc_html( $sales_count_data['wd_count_number'] ); ?></span> <span class="wd-info-msg">sales</span> </div> <?php }, 100);
January 20, 2025 at 8:47 am #630965
Hung PhamKeymasterHi Amit,
First of all, I am appreciate your patience.
If you have a quick minute we always appreciate a 5-star rating on our theme!
https://themeforest.net/item/woodmart-woocommerce-wordpress-theme/reviews/20264492
Your feedback is the motivation to improve our work and services.
Regards,
-
AuthorPosts
The topic ‘Adding total sales to Product Archive Grid’ is closed to new replies.
- You must be logged in to create new topics. Login / Register