• 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

Laravel-fopen: failed to open stream: Permission denied

XDebug not working in VScode for php debugging

Extract string between first whitespace and last whitespace in php

How can I format this number correctly using PHP?

laravel controller function parameters

java URL working on browser but not in client program

Limit login attempts in Laravel 5.7

Woocommerce Checkout - Add conditional field required if one field is filled

Phpunit partial mock + proxy Entity

SQLSTATE[HY000]: General error: 1 table posts has no column named *

Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::fetch_assoc() [duplicate]

Remove categories with all childs derived from parent category

How to get quarter for future date using Carbon?

GuzzleHttp Hangs When Using Localhost

Respond with status code 401 on authentication failure using Laravel and Passport?

About Contact Privacy policy Terms and conditions