Message not showing on some products

In Progress Posted 2 years ago Paid on delivery
In Progress Paid on delivery

I have some code that is meant to show some text under add to cart button on every product

"Free Delivery in 2 - 4 Days.." (attached screenshot)

But on some product pages it doesn't show up. Can you make it show on all product pages?

Here it isn't showing: [login to view URL]

Here it is showing: [login to view URL]

Here is the code:

add_filter('woocommerce_get_availability_text', 'customizing_stock_availability_text', 1, 2);

function customizing_stock_availability_text($availability, $product) {

if (!$product->is_in_stock()) {

$availability = __('Sold Out: Back in stock August 2021. Enter your email to be notified', 'woocommerce');

} elseif ($product->managing_stock() && $product->is_on_backorder(1)) {

$availability = $product->backorders_require_notification() ? __('Available on backorder', 'woocommerce') : '';

} elseif ($product->managing_stock()) {

$availability = __('<a style="text-decoration: none;" href="delivery-and-returns/"><b>FREE</b> Delivery in 2 - 4 bus. days if you spend $85 (otherwise just $9) </a><div style="clear:both;"></div><hr>', 'woocommerce');

$stock_amount = $product->get_stock_quantity();

switch (get_option('woocommerce_stock_format')) {

case 'low_amount' :

if ($stock_amount <= get_option('woocommerce_notify_low_stock_amount')) {

/* translators: %s: stock amount */

$availability = sprintf(__('Only %s Available!', 'woocommerce'), wc_format_stock_quantity_for_display($stock_amount, $product));

}

break;

case '' :

/* translators: %s: stock amount */

$availability = sprintf(__('%s Available!', 'woocommerce'), wc_format_stock_quantity_for_display($stock_amount, $product));

break;

}

if ($product->backorders_allowed() && $product->backorders_require_notification()) {

$availability .= ' ' . __('(can be backordered)', 'woocommerce');

}

} else {

$availability = '';

}

return $availability;

}

WordPress PHP WooCommerce HTML CSS

Project ID: #31025006

About the project

33 proposals Remote project Active 2 years ago

Awarded to:

(546 Reviews)
9.0

33 freelancers are bidding on average $115 for this job

shahid864

Hello, I am ready to help you on Message not showing on some products, I want to discuss starting right now after having the full details, I have 10+ years of experience in web development and maintaining websites. Tha More

$66 AUD in 1 day
(774 Reviews)
7.5
gauravgargcs

Hello, I understand your project requirements, I can fix your issues which you mentioned In Your work description , Please come on chat so we can share your work, Thanks Gaurav D.

$140 AUD in 7 days
(150 Reviews)
7.5
VileGnosis

I can make your message appear on all pages. My average project completion time is within 3-5 hours on the same day. The skills I have include PHP, HTML5, CSS3, JavaScript, jQuery, WordPress Themes & Plugins, Web Scrap More

$60 AUD in 1 day
(249 Reviews)
7.0
Lavlu

Hello Sir, I understand project scope but having few questions that needs to be clear in more detail. Please let me know if we can discuss the requirement over chat or call. Will provide free support for my Work. Loo More

$140 AUD in 2 days
(53 Reviews)
7.1
websicon

Dear Client, I am an experienced PHP developer and will fix your message issue on your Wordpress website. Let's have chat to discuss. Thank you

$50 AUD in 2 days
(61 Reviews)
6.1
QbikThino

Hi there! I am Mahedi, a full stack developer. I have checked your screenshot and I'm certain I can do this job perfectly. I have 9+ years of experience in HTML, CSS, Bootstrap, Grid, Flex, Material UI, PHP, Laravel, More

$100 AUD in 7 days
(58 Reviews)
6.1
chdlivemasters

Hello, I can code some text under add to cart button on every product. I am available to start work on your website. I will do it very fast. Lets start...

$50 AUD in 2 days
(44 Reviews)
6.0
DestinyGuider

do you want same text on every product or you want dynamic text to be displayed? i am ready to start now Have read your description on project very carefully.

$99 AUD in 1 day
(65 Reviews)
5.7
MarkoNikovic

Hello Greetings of the day! I read your description and have rich experience in wordpress so i can finish your project in short time I’m looking forward to hearing from you soon. Thank you for considering my cover l More

$140 AUD in 7 days
(33 Reviews)
5.9
saaz109

Hello, how are you doing today? I have read your serious suggestion carefully. I am an expert in PHP, MySQL, WordPress, Custom WordPress Plugins and Themes Development, Modifying WordPress Core, WordPress Hooks, Short More

$140 AUD in 2 days
(56 Reviews)
5.8
anayapallavi

I can fix this problem and i can start right now. Thanks.

$60 AUD in 2 days
(45 Reviews)
5.5
Makakkikhan

Hi i will make the text "Free Delivery in 2 - 4 Days.." to all product page. I have 8+ year professional experience in web Designing and development. Please check my reviews to see my results, My first priority is my c More

$200 AUD in 1 day
(42 Reviews)
4.6
netforcelabs

★★★ FREE ONE MONTH SUPPORT AFTER PROJECT COMPLETION ★★★ I will help to resolve issues of your website according to your requirements. Please share the exact details. I have been working as a WordPress developer and w More

$250 AUD in 7 days
(7 Reviews)
4.6
rizwange4

Hi there, I'm a professional WordPress Developer, having vast experience in WordPress Themes & plugins customization & development, I have read your project description carefully & I'm sure about to deliver the project More

$90 AUD in 2 days
(26 Reviews)
4.0
sachinranakasmp7

Hi, I have 8+ years in UI/UX Designer & Front End Developer. I can do this job Perfectly. I can start immediately. My skills:|| Graphic Design || HTML || CSS || SASS || LESS || JQuery || JavaScrip, Bootstrap || Wo More

$110 AUD in 7 days
(7 Reviews)
3.1
iOSNitish

Hey! I'll fix this issue in few hours in just $30, why waste money somewhere else? Pay me after your work is complete. Send me a message to get it done on time. Thanks for your consideration.

$30 AUD in 7 days
(2 Reviews)
1.2
heenanebliu

Hi, After reviewing your complete job description along with the code and your site, I can surely help you to add the specific content under every product on your site. I have hands-on experience with WordPress WooCo More

$180 AUD in 3 days
(1 Review)
1.1
fahaduddin392

add_filter('woocommerce_get_availability_text', 'customizing_stock_availability_text', 1, 2); function customizing_stock_availability_text($availability, $product) { if (!$product->is_in_stock()) { $availability = __( More

$30 AUD in 7 days
(0 Reviews)
0.0
electronlgroup2

Hi We are in website development with WordPress since 10 years. We Can Do your project perfectly. Please let us know if you want a very good job Best regards

$140 AUD in 7 days
(0 Reviews)
0.0