• 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

How to add a sidebar to Woocommerce Shop Page?

PHP's array_map including keys

Add and update products to session cart in Laravel

Detect emoticons in string

Reorder attribute dropdown terms in Woocommerce single variable products

Adding custom body class to the custom archive pages

Getting public posts of a random user from Facebook API

Wordpress 'post_type_link' hides permalink

Phalcon: setStatusCode returns empty response

getting error while enter Command => php artisan route:list

Implode array with array of glue strings

how to get the header value, if we don't know the value because the value is random from the server

phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO)

Adding the custom page with add_menu_page function on Wordpress

PHP: Telegram Bot: Insert line break to text message

About Contact Privacy policy Terms and conditions