I managed to get this workign as I exactly wanted. And that was
- Call for page reload when variation is selected
- Pass Variation ID value into URL as attribute which I can process after reload on a single page using $_GET
- Keep the selected option
I am calling the script under:
add_action( 'woocommerce_before_add_to_cart_quantity', 'xenon_variation_modification' );
function xenon_variation_modification() {
global $product;
if ( $product->is_type('variable') ) {
global $post;
?>
}
I have researched for this at following sources:
Get currently selected variation id from Woocommerce variable product
https://sarathlal.com/get-variation-product-data-on-selecting-variation-options-woocommerce/
https://wordpress.stackexchange.com/questions/280125/custom-url-for-each-product-variation-rewrite-rules