• Resolved Tom

    (@tom-van-m)


    Hello team,

    I’m looking for an shortcode to display the stock status (not the number of items) in a product.

    I found this one, but it doesn’t work anymore.

    add_shortcode( 'stock_status', 'display_product_stock_status' );
    function display_product_stock_status( $atts) {
    
        $atts = shortcode_atts(
            array('id'  => get_the_ID() ),
            $atts, 'stock_status'
        );
    
        $product = wc_get_product( $atts['id'] );
    
        $stock_status = $product->get_stock_status();
    
        if ( 'instock' == $stock_status) {
            return '<p class="stock in-stock">In stock</p>';
        } else {
            return '<p class="stock out-of-stock">Out of stock</p>';
        }
    }
    Code goes in function.php file of your active child theme (or active theme). Tested and works.
    
    USAGE: [stock_status] (or with defining the product id [stock_status id='47'] where 47 is the product ID…)

    How can I make this work?

    Thanks sofar!
    Best, Tom

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Tom

    (@tom-van-m)

    Hello,

    I get this error using the code snippet:

    2022-09-29T12:32:45+00:00 CRITICAL Uncaught Error: Call to a member function get_stock_status() on bool in /home/HOSTINGPACKAGENAME/domains/WEBSITE.COM/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(484) : eval()'d code:11
    Stack trace:
    #0 /home/HOSTINGPACKAGENAME/domains/WEBSITE.COM/public_html/wp-includes/shortcodes.php(356): display_product_stock_status()
    #1 [internal function]: do_shortcode_tag()
    #2 /home/HOSTINGPACKAGENAME/domains/WEBSITE.COM/public_html/wp-includes/shortcodes.php(228): preg_replace_callback()
    #3 /home/HOSTINGPACKAGENAME/domains/WEBSITE.COM/public_html/wp-content/plugins/fusion-builder/inc/class-fusion-dynamic-data-callbacks.php(147): do_shortcode()
    #4 /home/HOSTINGPACKAGENAME/domains/WEBSITE.COM/public_html/wp-content/plugins/fusion-builder/inc/class-fusion-dynamic-data.php(371): Fusion_Dynamic_Data_Callbacks::dynamic_shortcode()
    #5 /home/HOSTINGPACKAGENAME/domains/WEBSITE.COM/public_html/wp-content/plugins/fusion-builder/inc/class-fusion-dynamic-data.php(335): Fusion_Dynamic_Data->get_value()
    #6 /home/HOSTINGPACKAGENAME/domains/d in /home/HOSTINGPACKAGENAME/domains/WEBSITE.COM/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(484) : eval()'d code op de lijn 11

    Any thoughts?

    Best, Tom

    Hello!

    I understand the code above is not working on your end, may I ask are you adding the code directly on your functions.php file? Or are you using a plugin to do that for you e.g. Code Snippets?

    To get a better understanding about your site setup please share a copy of your site’s System Status that is under WooCommerce > Status. Select “Get system report” and then “Copy for support”. Thanks.

    Thread Starter Tom

    (@tom-van-m)

    Hello Igor,

    Thanks, I’m using Code Snippets for placing the code indeed.

    Here is the systemreport. I changed the url’s and website name for privacy reasons.

    
    ### WordPress Environment ###
    
    WordPress address (URL): https://www.websiteclient.nl
    Site address (URL): https://www.websiteclient.nl
    WC Version: 6.8.2
    REST API Version: ✔ 6.8.2
    WC Blocks Version: ✔ 8.0.0
    Action Scheduler Version: ✔ 3.4.0
    Log Directory Writable: ✔
    WP Version: 6.0.2
    WP Multisite: –
    WP Memory Limit: 2 GB
    WP Debug Mode: –
    WP Cron: ✔
    Language: nl_NL
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: Apache/2
    PHP Version: 7.4.27
    PHP Post Max Size: 64 MB
    PHP Time Limit: 300
    PHP Max Input Vars: 2460
    cURL Version: 7.81.0
    OpenSSL/1.1.1k-fips
    
    SUHOSIN Installed: –
    MySQL Version: 8.0.27
    Max Upload Size: 64 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔
    
    ### Database ###
    
    WC Database Version: 6.8.2
    WC Database Prefix: wp_
    Totale database grootte: 807.63MB
    Database gegevens grootte: 599.78MB
    Database index grootte: 207.85MB
    wp_woocommerce_sessions: Data: 123.17MB + Index: 9.02MB + Engine InnoDB
    wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_woocommerce_order_items: Data: 6.52MB + Index: 2.52MB + Engine InnoDB
    wp_woocommerce_order_itemmeta: Data: 71.61MB + Index: 49.16MB + Engine InnoDB
    wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_actions: Data: 3.02MB + Index: 10.13MB + Engine InnoDB
    wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_logs: Data: 3.02MB + Index: 3.03MB + Engine InnoDB
    wp_aepc_logs: Data: 0.16MB + Index: 0.00MB + Engine InnoDB
    wp_awb_critical_css: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_commentmeta: Data: 0.01MB + Index: 0.02MB + Engine MyISAM
    wp_comments: Data: 35.83MB + Index: 12.67MB + Engine MyISAM
    wp_dpdconnect_batches: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_dpdconnect_jobs: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_dpdconnect_labels: Data: 0.33MB + Index: 0.02MB + Engine InnoDB
    wp_duplicator_pro_entities: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_duplicator_pro_packages: Data: 0.08MB + Index: 0.02MB + Engine InnoDB
    wp_fusion_form_entries: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_fusion_form_fields: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_fusion_form_submissions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_fusion_forms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_gwolle_gb_entries: Data: 0.03MB + Index: 0.00MB + Engine MyISAM
    wp_gwolle_gb_log: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_imagify_files: Data: 0.09MB + Index: 0.14MB + Engine InnoDB
    wp_imagify_folders: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_links: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_litespeed_img_optm: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_maintenance_page: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mclean_refs: Data: 1.52MB + Index: 0.00MB + Engine InnoDB
    wp_mclean_scan: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mollie_pending_payment: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_ms_snippets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_options: Data: 19.47MB + Index: 0.61MB + Engine MyISAM
    wp_pmxe_templates: Data: 0.05MB + Index: 0.00MB + Engine InnoDB
    wp_postmeta: Data: 233.13MB + Index: 73.33MB + Engine MyISAM
    wp_posts: Data: 27.64MB + Index: 3.85MB + Engine MyISAM
    wp_revslider_css: Data: 0.14MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_layer_animations: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_navigations: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_sliders: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_slides: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_static_slides: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_smush_dir_images: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_snippets: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_term_relationships: Data: 1.02MB + Index: 2.19MB + Engine MyISAM
    wp_term_taxonomy: Data: 0.81MB + Index: 1.15MB + Engine MyISAM
    wp_termmeta: Data: 0.23MB + Index: 0.20MB + Engine InnoDB
    wp_terms: Data: 0.77MB + Index: 1.11MB + Engine MyISAM
    wp_usermeta: Data: 12.32MB + Index: 8.15MB + Engine MyISAM
    wp_users: Data: 0.61MB + Index: 0.72MB + Engine MyISAM
    wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_admin_notes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_customer_lookup: Data: 2.52MB + Index: 1.91MB + Engine InnoDB
    wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_gpf_render_cache: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_order_coupon_lookup: Data: 0.06MB + Index: 0.03MB + Engine InnoDB
    wp_wc_order_product_lookup: Data: 5.52MB + Index: 8.06MB + Engine InnoDB
    wp_wc_order_stats: Data: 2.52MB + Index: 3.44MB + Engine InnoDB
    wp_wc_order_tax_lookup: Data: 1.52MB + Index: 2.00MB + Engine InnoDB
    wp_wc_product_attributes_lookup: Data: 1.42MB + Index: 2.27MB + Engine InnoDB
    wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_product_meta_lookup: Data: 1.52MB + Index: 1.75MB + Engine InnoDB
    wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wcpdf_invoice_number: Data: 1.52MB + Index: 0.00MB + Engine InnoDB
    wp_webwinkelkeur_invite_error: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wfBlockedIPLog: Data: 0.41MB + Index: 0.00MB + Engine InnoDB
    wp_wfBlocks7: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_wfConfig: Data: 2.27MB + Index: 0.00MB + Engine InnoDB
    wp_wfCrawlers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wfFileChanges: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wfFileMods: Data: 15.55MB + Index: 0.00MB + Engine InnoDB
    wp_wfHits: Data: 1.02MB + Index: 0.23MB + Engine InnoDB
    wp_wfHoover: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wfIssues: Data: 0.08MB + Index: 0.06MB + Engine InnoDB
    wp_wfKnownFileList: Data: 7.52MB + Index: 0.00MB + Engine InnoDB
    wp_wfLiveTrafficHuman: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wfLocs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wfLogins: Data: 0.45MB + Index: 0.16MB + Engine InnoDB
    wp_wfNotifications: Data: 0.08MB + Index: 0.00MB + Engine InnoDB
    wp_wfPendingIssues: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_wfReverseCache: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wfSNIPCache: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_wfStatus: Data: 0.13MB + Index: 0.11MB + Engine InnoDB
    wp_wfTrafficRates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wfls_2fa_secrets: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wfls_settings: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_gpf_google_taxonomy: Data: 3.02MB + Index: 0.23MB + Engine InnoDB
    wp_wpca_logs: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
    wp_wpca_logs_legacy: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
    wp_wpil_broken_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wpil_click_data: Data: 3.52MB + Index: 6.58MB + Engine InnoDB
    wp_wpil_ignore_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wpil_keyword_links: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wpil_keyword_select_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wpil_keywords: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wpil_report_links: Data: 1.50MB + Index: 0.55MB + Engine InnoDB
    wp_wpil_target_keyword_data: Data: 1.52MB + Index: 0.44MB + Engine InnoDB
    wp_wpil_url_links: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wpil_urls: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wpmailsmtp_debug_events: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wpr_rocket_cache: Data: 0.19MB + Index: 0.27MB + Engine InnoDB
    wp_wpr_rucss_used_css: Data: 0.02MB + Index: 0.08MB + Engine InnoDB
    wp_yoast_seo_links: Data: 1.44MB + Index: 0.28MB + Engine InnoDB
    wp_yoast_seo_meta: Data: 1.52MB + Index: 0.00MB + Engine InnoDB
    
    ### Post Type Counts ###
    
    af_product_videos: 2
    amn_exact-metrics: 1
    amn_smtp: 1
    attachment: 6102
    bol_invoice: 2
    customize_changeset: 4
    cwginstocknotifier: 1
    fusion_element: 24
    fusion_icons: 1
    fusion_tb_layout: 1
    fusion_tb_section: 1
    fusion_template: 7
    iwp-importer: 1
    mc4wp-form: 2
    ml-slider: 2
    nav_menu_item: 51
    nth_stblock: 3
    oembed_cache: 12
    page: 46
    popup: 1
    popup_theme: 9
    post: 1
    product: 956
    product_variation: 6080
    revision: 472
    shop_coupon: 11
    shop_order: 28099
    shop_order_refund: 172
    slide: 2
    tm_global_cp: 21
    wc_order_email: 3
    wc_order_status: 23
    wp_global_styles: 1
    wpcf7_contact_form: 2
    
    ### Security ###
    
    Secure connection (HTTPS): ✔
    Hide errors from visitors: ✔
    
    ### Active Plugins (44) ###
    
    Advanced Cron Manager: door BracketSpace – 2.4.2
    Advanced Database Cleaner PRO: door Younes JFR. – 3.2.1
    FiboSearch - AJAX Search for WooCommerce: door FiboSearch Team – 1.19.0
    ARG MultiStep Checkout for WooCommerce: door ARG Themes – 4.0.2
    Code Snippets: door Code Snippets Pro – 3.2.0
    Honeypot for Contact Form 7: door Nocean – 2.1.1
    Contact Form 7: door Takayuki Miyoshi – 5.6.3
    Disable Right Click For WP: door Aftab Muni – 1.1.6
    DPD Connect voor WooCommerce: door DPD / X-Interactive.nl – 1.3.9
    GTM4WP: door Thomas Geiger – 1.16.1
    Envato Market: door Envato – 2.0.7
    EU/UK VAT for WooCommerce: door WPWhale – 2.7.2
    Avada Builder: door ThemeFusion – 3.8.2
    Avada Core: door Thema opties – 5.8.2
    Avada Custom Branding: door ThemeFusion – 1.2
    Imagify: door Imagify - Optimize Images & Convert WebP – 2.0
    Kadence WooCommerce Email Designer: door Kadence WP – 1.5.7
    Link Whisper: door Link Whisper – 2.0.9
    Loco Translate: door Tim Whitlock – 2.6.2
    Maintenance Page: door ThemeGrill – 1.0.8
    MainWP Child: door MainWP – 4.2.4
    Mollie-betalingen voor WooCommerce: door Mollie – 7.3.3
    Premmerce Product Filter for WooCommerce: door premmerce – 3.7
    PW WooCommerce Bulk Edit Pro: door Pimwick
    LLC – 2.335
    
    WooCommerce - Show only lowest prices in variable products: door Fernando Tellado – 0.9.31
    WebwinkelKeur: door Albert Peschar – 3.18
    WooCommerce Weight Based Shipping: door weightbasedshipping.com – 5.3.23
    WooCommerce Custom Add To Cart Button: door Barn2 Plugins – 1.1.3
    WPC Fly Cart for WooCommerce (Premium): door WPClever – 5.0.9
    WooCommerce Order Status Manager: door SkyVerge – 1.13.4
    WooCommerce PDF Invoices & Packing Slips: door WP Overnight – 3.1.0
    WooCommerce Product CSV Import Suite: door WooCommerce – 1.10.49
    WooCommerce Google Product Feed: door Ademti Software Ltd. – 10.7.4 (update naar versie 10.7.6 is beschikbaar)
    WooCommerce Product Table: door Barn2 Plugins – 3.0.1
    WooCommerce TM Extra Product Options: door themeComplete – 5.0.12.10
    WooCommerce: door Automattic – 6.8.2 (update naar versie 6.9.4 is beschikbaar)
    Wordfence Security: door Wordfence – 7.6.2
    Yoast SEO Premium: door Team Yoast – 11.5
    Asset CleanUp: Page Speed Booster: door Gabe Livan – 1.3.8.5
    WeePie Cookie Allow: door WeePie Plugins – 3.4.2
    WP Mail SMTP: door WPForms – 3.5.2
    WP Rocket | Deactivate WooCommerce Refresh Cart Fragments Cache: door WP Rocket Support Team –
    WP Rocket | Custom Sitemap Preload Intervals: door WP Rocket Support Team –
    WP Rocket: door WP Media – 3.12.1.1
    
    ### Inactive Plugins (14) ###
    
    Advanced Dynamic Pricing for WooCommerce: door AlgolPlus – 4.1.5
    Asset CleanUp Pro: Page Speed Booster: door Gabe Livan – 1.1.9.5
    Boekuwzending for WooCommerce: door Boekuwzending.com – 1.2.4
    Duplicator Pro: door Snap Creek – 4.0.6
    Hotjar: door Hotjar – 1.0.14
    Media Cleaner: door Jordy Meow – 6.4.5
    PAY. Payment Methods for WooCommerce: door PAY. – 3.9.1
    Product Designer for WooCommerce: door FantasticPlugins – 4.0
    WooCommerce Estimated Shipping Date: door Mohammed Saimon – 4.2.0
    WP-Optimize - Clean, Compress, Cache: door David Anderson
    Ruhani Rabin
    Team Updraft – 3.2.7
    
    WP-Sweep: door Lester 'GaMerZ' Chan – 1.1.5
    WPCode - Insert Headers, Footers, and Code Snippets: door WPCode – 2.0.2
    YITH WooCommerce Advanced Reviews Premium: door YITH – 1.16.0
    YITH WooCommerce Customize My Account Page: door YITH – 3.12.0
    
    ### Dropin Plugins (1) ###
    
    advanced-cache.php: advanced-cache.php
    
    ### Settings ###
    
    API Enabled: ✔
    Force SSL: ✔
    Currency: EUR (€)
    Currency Position: left
    Thousand Separator: .
    Decimal Separator: ,
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    
    Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
    exclude-from-search (exclude-from-search)
    featured (featured)
    outofstock (outofstock)
    rated-1 (rated-1)
    rated-2 (rated-2)
    rated-3 (rated-3)
    rated-4 (rated-4)
    rated-5 (rated-5)
    
    Connected to WooCommerce.com: ✔
    Enforce Approved Product Download Directories: –
    
    ### WC Pages ###
    
    Winkelbasis: #7 - /shop/
    Winkelwagen: #8 - /cart/
    Afrekenen: #9 - /checkout/
    Mijn account: #10 - /my-account/
    Algemene voorwaarden: #4633 - /algemene-voorwaarden/
    
    ### Theme ###
    
    Name: Avada
    Version: 7.8.2
    Author URL: https://themeforest.net/user/ThemeFusion
    Child Theme: ❌ – Als je wijzigingen aanbrengt in WooCommerce of in een hoofdthema dat je niet zelf gebouwd hebt
    raden we het gebruik van een sub-thema aan. Zie: Hoe maak je een sub-thema
    
    WooCommerce Support: ✔
    
    ### Templates ###
    
    Overrides: Avada/woocommerce/cart/cart.php
    Avada/woocommerce/checkout/form-pay.php
    Avada/woocommerce/checkout/review-order.php
    Avada/woocommerce/checkout/thankyou.php
    Avada/woocommerce/loop/loop-start.php
    Avada/woocommerce/single-product/add-to-cart/variable.php
    Avada/woocommerce/single-product/short-description.php
    Avada/woocommerce/single-product/tabs/additional-information.php
    Avada/woocommerce/single-product/tabs/description.php
    
    ### Pimwick Plugins ###
    
    PW WooCommerce Bulk Edit Pro: License key: PW-5e8304c55e284
    Result: success
    Cached: 2022-10-03
    PW-5c55f3dc97ca3
    
    ### WooCommerce Google Product Feed feeds ###
    
    google: Google merchant centre product feed
      Type: google
      Category filter: -
      Categories: -
    googleinventory: Google merchant centre product inventory feed (legacy)
      Type: googleinventory
      Category filter: -
      Categories: -
    bing: Bing merchant centre feed
      Type: bing
      Category filter: -
      Categories: -
    
    ### WooCommerce Google Product Feed options ###
    
    Include variations in feed: -
    Send "item group ID": -
    Expanded schema markup: -
    Debug key: 4a26d165-70d8-4188-8e1d-09ffb91403e9
    
    ### WooCommerce Google Product Feed fields ###
    
    Title: Pre-populates from product product_title.
    Product description: Variation description only
    fallback to main description (full preferred)
    
    Availability (in stock products): Defaults to "in stock".
    Availability (backordered products): Defaults to "in stock".
    Availability (out of stock products): Defaults to "out of stock".
    Brand: Defaults to "Client websiite name".
    Product Type: Pre-populates from product_cat taxonomy.
    Google Product Category: 
    Global Trade Item Number (GTIN): Pre-populates from pa_gtin taxonomy.
    
    ### WooCommerce Google Product Feed DB status ###
    
    Database version: 15
    Active database version: 15
    wc_gpf_render_cache: Empty
    woocommerce_gpf_google_taxonomy (en-US): 5595 items
    woocommerce_gpf_google_taxonomy (nl-NL): 5595 items
    
    ### Admin ###
    
    Enabled Features: activity-panels
    analytics
    coupons
    customer-effort-score-tracks
    experimental-products-task
    experimental-import-products-task
    experimental-fashion-sample-products
    experimental-product-tour
    shipping-smart-defaults
    shipping-setting-tour
    homescreen
    marketing
    mobile-app-banner
    navigation
    onboarding
    onboarding-tasks
    remote-inbox-notifications
    remote-free-extensions
    payment-gateway-suggestions
    shipping-label-banner
    subscriptions
    store-alerts
    transient-notices
    wc-pay-promotion
    wc-pay-welcome-page
    wc-pay-subscriptions-page
    
    Disabled Features: minified-js
    settings
    
    Daily Cron: ✔ Next scheduled: 2022-10-03 12:35:31 +02:00
    Options: ✔
    Notes: 19
    Onboarding: completed
    
    ### Action Scheduler ###
    
    Complete: 7.972
    Oldest: 2022-09-03 16:27:08 +0200
    Newest: 2022-10-03 08:57:59 +0200
    
    Failed: 5
    Oldest: 2021-07-06 21:57:11 +0200
    Newest: 2021-12-05 03:21:55 +0100
    
    Pending: 2
    Oldest: 2022-10-03 09:06:07 +0200
    Newest: 2022-10-03 11:14:12 +0200
    
    ### Status report information ###
    
    Generated at: 2022-10-03 09:06:38 +02:00
    

    If you need more, please let me know!

    Best, Tom

    • This reply was modified 2 years, 2 months ago by Tom.

    Hi there @tom-van-m 👋

    Thanks, I’m using Code Snippets for placing the code indeed.

    Thank you for clarifying further. I understand you found the code on this StackOverflow page, correct?

    Could you make sure you have adjusted the inventory settings in WooCommerce, as shown in this screenshot and, additionally, explained in the documentation here, for setting up product inventory?

    With those settings, I am able to show the stock status on the front end, without using any code.

    The theme in my test site is currently Skatepark. Therefore, if you are not able to show stock status on the front end using the settings mentioned here, feel free to get in touch with your theme’s (Avada) support.

    I hope that helps!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Shortcode to show Stock Status’ is closed to new replies.