The membership button can be shown only on some specific products by following the below steps –
Step 1. From Shopify Admin, go to the Online Store > Themes > Actions(Published Theme) > Edit Code(Published Theme).
Step 2. Open file product-template.liquid under Sections.
Step 3. Copy the below code and wrap it around the cart button element available in the file.
Step 4. Now, open the product in Shopify backend in which you need the membership button and copy its handle.
Step 5. Paste this copied product handle in the product-template.liquid file as mentioned in step 3.
Step 6. Now, copy the membership plan embed code and paste in the product-template.liquid file as mentioned in step 3.