cirrus123
Forum Replies Created
-
Now added:
wc_delete_product_transients($post_id);
where postid is the product id. This successfully lists the variations on the public product page, but does not update the pricing range and does not show the price of the variations even when picked.
This is a crucial issue with my current plugin – I have been trying to rectify it for quite some time now. Any assistance would be appreciated. To summarize:
Is there a function that I can run that updates the product with all the added variations and their prices so that the price range and all options become available on the front end?
I have checked to confirm that the post entries in the database is identical for all public and non-pubic variations.
I have also confirmed that all meta entries for these are identical.
This leads to the notion that it is likely a supplementary table that somehow links these variations to the product publicly, and I need to trigger updating it.
Notes:
1) If I add variations, nothing updates on the front end.
2) If I add variations, then delete one, the variations update on the front end, but the pricing does not (you can pick the variation but pricing does not reflect that variation’s pricing).
3) If I have publicly active variations that I entered and published manually, and I also have the ones I programmed to be added (that aren’t showing up publicly), and I remove any of the public variations programmatically, it displays all the remaining variations and pricing correctly.
Therefore, upon deleting a non-public variation using ‘wp_delete_post’ an update occurs that does not happen when you add a variation using ‘wp_insert_post’.
Even though this update occurs, it is not complete because pricing does not update.
Further, when woocommerce/wordpress notices that a public variation is removed, it somehow resets something that then makes all the programmatically added variations active.
Forum: Plugins
In reply to: [WooCommerce] taxonomy_exists for product attribute always returns falseI have now added this:
register_taxonomy( 'pa_size', apply_filters( 'woocommerce_taxonomy_objects_' . 'pa_size', array('product') ), apply_filters( 'woocommerce_taxonomy_args_' . 'pa_size', array( 'hierarchical' => true, 'show_ui' => false, 'query_var' => true, 'rewrite' => false, ) ) );
…which makes taxonomy_exists return true, but only on that same pageload where the attribute was added. When the page is refreshed, the function again returns false.
That suggests, to me, that ‘register taxonomy’, as called by woocommerce for all the custom product attributes, is being called at some other point in the script which is why the taxonomy is not appearing registered to wordpress when I am trying to access it.
Forum: Plugins
In reply to: [WooCommerce] taxonomy_exists for product attribute always returns falsedelete_transient( ‘wc_attribute_taxonomies’ );
does not solve the problem. In fact, if I ‘get_transient’ for the same table it spits out the correct information (the ‘size’ type shows up)
Therefore, it does not seem to be held up by the transient tables.
There is some disconnect occurring between the addition of a new global product attribute and wordpress seeing that taxonomy.
Forum: Plugins
In reply to: [WooCommerce] taxonomy_exists for product attribute always returns falseJust to be clear – I am using the code:
taxonomy_exists(‘pa_size’)
for the size product attribute, for example.
Forum: Plugins
In reply to: [WooCommerce] get_terms for 'pa_' attribute returning nothingget_terms(‘pa_size’, ‘hide_empty=0’ );
works. no clue why.
Forum: Plugins
In reply to: [WooCommerce] Cannot remove 'Shipping Classes' admin menu item (bug?)Solved by removing it from the add_submenu function, rather than a taxonomy function.
Forum: Plugins
In reply to: [WooCommerce] Add pricing field to global custom attributeI figured out the first part – it’s basically adding a field to a custom taxonomy.
Now I just have to use that data to prepopulate the associated fields in the product edit page.