You need to register a ‘rewrite endpoint’ using add_rewrite_endpoint()
:
<?php
add_action(
'init',
function() {
add_rewrite_endpoint( 'play', EP_PERMALINK );
}
);
Now, after flushing permalinks, in whatever template or code you’re using for your products you can check this to determine whether the /play
version of the URL is being accessed:
<?php
if ( false !== get_query_var( 'play', false ) ) {
// True for mydomain.tld/product/play-and-win-samsung-galaxy-s22/play
} else {
// True for mydomain.tld/product/play-and-win-samsung-galaxy-s22
}