• 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

PHP - Store information with NO database

Laravel SQL query midnight time not showing

How can i update or reset my password without entering email field in laravel-8?

Uploading video to Youtube using Youtube Data API V3 and Google API Client PHP -- getting 401 (unauthorized) message

how to check version of codeigniter framework?

How do I set the maximum php memory limit

Manage independently the decimal number of the price of each product [duplicate]

selected value from the listbox in php

Sagepay Error The Vendor failed to provide a RedirectionURL

PHP function Not Working As Expected From functions.php Include File

Laravel Carbon throws error The format separator does not match

Autoloading classes in PHPUnit using Composer and autoload.php

Malformed MIME header error in Symfony 5.3

Send same name multiple checkbox values via ajax

echo language construct is discouraged. (PHP)

About Contact Privacy policy Terms and conditions