Jump to content


information

Is There A Way To Change The Inventory Message?



5 replies to this topic

#1 tblocke

tblocke

    Member

  • Members
  • Others: All Plugins, BackupBuddy
  • PipPip
  • 13 posts

Posted 05 June 2014 - 02:22 PM

Hi,

Instead of displaying "This product is out of stock" when the inventory becomes 0, is there a way to customize this message?

For example, if running an online course, have it display "This course is full".

Thanks.

#2 Elise Alley

Elise Alley

    iThemes Support

  • Administrators
  • Others: All Plugins, All Themes, Members, Moderators, Toolkit, Webdesign
  • 5,373 posts
  • LocationOklahoma City, OK

Posted 05 June 2014 - 03:13 PM

Hi tblocke,

There isn't an option to do this in the Product Variants add-on.  

I do have some code that may work for you though.  Try adding this to the bottom of your child theme's functions.php file (before the closing ?> if there is one):

function my_translated_text_strings( $translated_text, $untranslated_text, $domain ) {
$translated_text = $untranslated_text;
if ( 'LION' === $domain || 'it-l10n-ithemes-exchange' === $domain ) {
switch ( $untranslated_text ) {
case 'Product is currently out of stock.' :
$translated_text = ‘This course is full.’;
break;
}
}
return $translated_text;
}
add_filter( 'gettext', 'my_translated_text_strings', 10, 3 );
add_filter( 'ngettext', 'my_translated_text_strings', 10, 3 );

Give that a try and let us know how it goes.

Thanks,

Elise

#3 tblocke

tblocke

    Member

  • Members
  • Others: All Plugins, BackupBuddy
  • PipPip
  • 13 posts

Posted 05 June 2014 - 03:30 PM

Thanks for the code.  Unfortunately, all pages on the site go blank (white, no errors) when adding this code.

#4 Elise Alley

Elise Alley

    iThemes Support

  • Administrators
  • Others: All Plugins, All Themes, Members, Moderators, Toolkit, Webdesign
  • 5,373 posts
  • LocationOklahoma City, OK

Posted 05 June 2014 - 03:37 PM

Hi tblocke,

It's working on my site:

Screen Shot 2014-06-05 at 4.34.57 PM.png

I think some of the apostrophes might have not converted correctly to plain text when I pasted into this post, though, so try this:

function my_translated_text_strings( $translated_text, $untranslated_text, $domain ) {
$translated_text = $untranslated_text;
if ( 'LION' === $domain || 'it-l10n-ithemes-exchange' === $domain ) {
switch ( $untranslated_text ) {
case 'Product is currently out of stock.' :
$translated_text = 'This course is full.';
break;
}
}
return $translated_text;
}
add_filter( 'gettext', 'my_translated_text_strings', 10, 3 );
add_filter( 'ngettext', 'my_translated_text_strings', 10, 3 );

If that doesn't work for you, it might be an issue on your site.  Can you please (always :)) provide us with the URL for your site?

Thanks,

Elise

#5 tblocke

tblocke

    Member

  • Members
  • Others: All Plugins, BackupBuddy
  • PipPip
  • 13 posts

Posted 05 June 2014 - 04:11 PM

That's what it was...works perfectly!

Thanks again!

#6 Elise Alley

Elise Alley

    iThemes Support

  • Administrators
  • Others: All Plugins, All Themes, Members, Moderators, Toolkit, Webdesign
  • 5,373 posts
  • LocationOklahoma City, OK

Posted 05 June 2014 - 04:13 PM

Happy to have helped, tblocke!

Let us know if you have any other questions!

Thanks,

Elise



Reply to this Topic


ATTENTION
If this topic is marked RESOLVED or INFORMATION, or if you are NOT experiencing EXACTLY the same issue, please start a new topic to provide the details of your problem. If the solution provided doesn't work for you, you should start a new topic. If you feel this thread contains relevant information, you may include a link to it in your new topic. To ensure that we can process your support request efficiently, ALWAYS include a link to your site, and/or the page your request is related to. When posting your question or request on the forum, please be as concise and specific as possible. The shorter and more to the point you can make your request, the better.

For BackupBuddy related issues, be sure to include the status log from your most recent backup.

CLICK HERE to start a new topic in the Exchange ecommerce plugin forum.


  



Also tagged with one or more of these keywords: information

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users