Plugin Directory

Changeset 3436382


Ignore:
Timestamp:
01/10/2026 04:48:03 AM (2 months ago)
Author:
magecomp
Message:

Updated Blueprint

File:
1 edited

Legend:

Unmodified
Added
Removed
  • magecomp-pincode-checker/assets/blueprints/blueprint.json

    r3435640 r3436382  
    22    "$schema": "https://playground.wordpress.net/blueprint-schema.json",
    33    "meta": {
    4     "title": "MageComp Pincode Checker – Live Demo",
    5     "description": "WooCommerce products + Pincode Checker with demo pincodes",
    6     "author": "MageComp",
    7     "categories": [
    8       "woocommerce",
    9       "ecommerce"
    10     ]
    11   },
     4        "title": "MageComp Pincode Checker – Live Demo",
     5        "description": "WooCommerce products + Pincode Checker with demo pincodes",
     6        "author": "MageComp",
     7        "categories": [
     8            "woocommerce",
     9            "ecommerce"
     10        ]
     11    },
    1212    "preferredVersions": {
    1313        "php": "8.3",
     
    5050        {
    5151            "step": "runPHP",
    52             "code": "<?php\nrequire_once '/wordpress/wp-load.php';\n\n$products = [\n    ['V-Neck T-Shirt', 'Comfortable v-neck t-shirt. Perfect for casual wear.', 19.99, 17.99, 10],\n    ['Hoodie', 'Cozy winter hoodie with drawstrings.', 45.00, 39.99, 5],\n    ['Classic T-Shirt', '100% cotton classic crew neck t-shirt.', 15.99, 15.99, 20]\n];\n\nforeach ($products as $p) {\n    $post_id = wp_insert_post([\n        'post_title' => $p[0],\n        'post_content' => $p[1],\n        'post_status' => 'publish',\n        'post_type' => 'product'\n    ]);\n\n    if ($post_id && !is_wp_error($post_id)) {\n        update_post_meta($post_id, '_regular_price', $p[2]);\n        update_post_meta($post_id, '_sale_price', $p[3]);\n        update_post_meta($post_id, '_price', $p[3]);\n        update_post_meta($post_id, '_manage_stock', 'yes');\n        update_post_meta($post_id, '_stock', $p[4]);\n        update_post_meta($post_id, '_stock_status', 'instock');\n        wp_set_object_terms($post_id, 'simple', 'product_type');\n    }\n}\n"
     52            "code": "<?php\nrequire_once '/wordpress/wp-load.php';\nrequire_once ABSPATH . 'wp-admin/includes/file.php';\nrequire_once ABSPATH . 'wp-admin/includes/media.php';\nrequire_once ABSPATH . 'wp-admin/includes/image.php';\n\n// Single product data\n$title       = 'Laptop';\n$description = 'A laptop suitable for everyday use.';\n$price       = 599.99;\n$sale_price  = 549.99;\n$stock       = 5;\n\n// Product image\n$image_url = 'https://subcategoryslider.magecomp.org/pub/media/catalog/product/cache/207e23213cf636ccdef205098cf3c8a3/l/a/laptop-black.png';\n\n$post_id = wp_insert_post([\n    'post_title'   => $title,\n    'post_content' => $description,\n    'post_status'  => 'publish',\n    'post_type'    => 'product'\n]);\n\nif ($post_id && !is_wp_error($post_id)) {\n    update_post_meta($post_id, '_regular_price', $price);\n    update_post_meta($post_id, '_sale_price', $sale_price);\n    update_post_meta($post_id, '_price', $sale_price);\n    update_post_meta($post_id, '_manage_stock', 'yes');\n    update_post_meta($post_id, '_stock', $stock);\n    update_post_meta($post_id, '_stock_status', 'instock');\n    wp_set_object_terms($post_id, 'simple', 'product_type');\n\n    // Set featured image\n    $attachment_id = media_sideload_image($image_url, $post_id, null, 'id');\n    if (!is_wp_error($attachment_id)) {\n        set_post_thumbnail($post_id, $attachment_id);\n    }\n}\n"
    5353        },
    5454        {
Note: See TracChangeset for help on using the changeset viewer.