Automatically creating variations from attributes
-
### WordPress Environment ### Home URL: https://www.eaglenestmedia.com/edshop Site URL: https://www.eaglenestmedia.com/edshop WC Version: 3.0.8 Log Directory Writable: ? WP Version: 4.8 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: ? WP Cron: ? Language: en ### Server Environment ### Server Info: Apache PHP Version: 5.6.17 PHP Post Max Size: 64 MB PHP Time Limit: 30 PHP Max Input Vars: 1000 cURL Version: 7.36.0 OpenSSL/1.0.1e SUHOSIN Installed: – MySQL Version: ? 5.5.52 - We recommend a minimum MySQL version of 5.6. See: WordPress requirements Max Upload Size: 32 MB Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? ### Database ### WC Database Version: 3.0.8 WC Database Prefix: wp_ woocommerce_sessions: ? woocommerce_api_keys: ? woocommerce_attribute_taxonomies: ? woocommerce_downloadable_product_permissions: ? woocommerce_order_items: ? woocommerce_order_itemmeta: ? woocommerce_tax_rates: ? woocommerce_tax_rate_locations: ? woocommerce_shipping_zones: ? woocommerce_shipping_zone_locations: ? woocommerce_shipping_zone_methods: ? woocommerce_payment_tokens: ? woocommerce_payment_tokenmeta: ? MaxMind GeoIP Database: ? The MaxMind GeoIP Database does not exist - Geolocation will not function. You can download and install it manually from https://dev.maxmind.com/geoip/legacy/geolite/ to the path: . Scroll down to "Downloads" and download the "Binary / gzip" file next to "GeoLite Country". Please remember to uncompress GeoIP.dat.gz and upload the GeoIP.dat file only. ### Security ### Secure connection (HTTPS): ?Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates. Hide errors from visitors: ? ### Active Plugins (10) ### Gravity Forms: by rocketgenius – 2.2.3.1 Genesis Connect for WooCommerce: by StudioPress – 0.9.9 Gravity Forms User Registration Add-On: by rocketgenius – 3.7.4 Limit Login Attempts: by Johan Eenfeldt – 1.7.1 Members: by Justin Tadlock – 1.1.3 Soliloquy: by Soliloquy Team – 2.5.3.1 TablePress: by Tobias B?thge – 1.8 User Meta Display: by Myles McNamara – 1.2.2 WooCommerce: by Automattic – 3.0.8 WordPress Importer: by wordpressdotorg – 0.6.3 ### Settings ### API Enabled: ? Force SSL: – Currency: USD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) ### WC Pages ### Shop base: #7 - /shop/ Cart: #8 - /cart/ Checkout: #9 - /checkout/ My account: #10 - /my-account/ ### Theme ### Name: Jessica Version: 1.3.2 Author URL: https://www.web-savvy-marketing.com/ Child Theme: ? Parent Theme Name: Genesis Parent Theme Version: 2.5.0 Parent Theme Author URL: https://www.studiopress.com/ WooCommerce Support: ? ### Templates ### Overrides: jessica/woocommerce/single-product/meta.php version 1.6.4 is out of date. The core version is 3.0.0 jessica/taxonomy-product_tag.php Outdated Templates: ?Learn how to update
This isn’t an issue/complaint, but a how-to request.
Using the REST API, I have been able to add code to the functions file that creates a bunch of products which automatically have variations assigned to them. Elegant, and cool!
If I go and visit those products on the back end, they’re already variable, they already have their attributes, but you have to create the variations using the normal method of hitting the button and them being spit out magically on the product edit screen.
IF that has already happened, I can use the API once again to iterate through all the variations for a given product and assign them prices.
What I haven’t been able to figure out how to do is give them prices to begin with (I can add a price in my code for the parent, but it doesn’t even show up for the parent if there are variations, and of course doesn’t go into the variations as it seems that’s read-only by default)…
…and, secondly, I would love to pieces to know if there was a programmatic way to ask those variations to be made via code instead of the button-pressing. I saw another thread here where Mr. Jolley said it was possible but that no solution existed yet that was already pre-made…I am not looking for free code or to take up too much of anyone’s time…but..if it IS possible…where would I start? Is there a hook or filter I could dive into the code to read about? What’s making the button you have to press tick and how could I emulate it?
The basic setup we have is that people are registering and opting into what kind of products to have created for them. As of this moment, they get created but they have to go into each product and generate all of them and add prices manually after the fact, so it doesn’t feel like much of a time savings past a point.
Which isn’t a slam. Woo does a lot of cool things by default, and this is a little out there. But knowing that it could be done, I just wanna know where to sniff to get started. Any insight is helpful. God bless!
- The topic ‘Automatically creating variations from attributes’ is closed to new replies.