• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Get all WooCommerce products within own plugin

phpwordpresswoocommerceproducthook-woocommerce


PHP Snippet 1:

if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
        // Put your plugin code here
        add_action( 'woocommerce_loaded', 'generate_product_qr_codes' );
    }
    
    function generate_product_qr_codes() {
    
        $args        = array( 'post_type' => 'product', 'posts_per_page' => -1 );
        $products    = get_posts( $args );
        echo '<pre>$products:-';
        print_r( $products );
        echo '</pre>';
    }

Related Snippets

SlimExceptionHttpNotFoundException

PHP echo values of all sub keys [duplicate]

How to set dynamic `home` and `siteurl` in WordPress?

Render the content of default_filter.php in Joomla front-end

Declaration of OMDb::query(string $statement) must be compatible with PDO::query

Multiple order by in WooCommerce

Last order would be re-order in wooCommerce. How is it possible?

Composer Warning: openssl extension is missing. How to enable in WAMP

Sagepay Error The Vendor failed to provide a RedirectionURL

add_action() function in wordpress not working [duplicate]

How to modify CSS in a specific page of the WP admin dashboard (backend)

auth pages not getting css in laravel

Transpose multidimensional array and join values with commas

Extract house numbers from address string

PHP Download MP3 files from directory on server

About Contact Privacy policy Terms and conditions