MultivendorX Pro
-
AuthorPosts
-
-
April 10, 2023 at 12:44 PM #190605ChrisParticipant
Hi support,
I’m using this code to convert any products with price of $0 to the words “FREE”. Since the membership plans are from the products, so it shows the word “FREE” when it is in product view. However, I would like to make the membership plans shown during registration for vendor that cost $0 to show the word “FREE” too. Could you please help me to modify or add the code filters and strings?
add_filter( ‘woocommerce_get_price_html’, ‘change_zero_price_display’, 10, 2 );
function change_zero_price_display( $price, $product ) {
if (empty($product->get_price()) || $product->get_price() == 0) { // If price is not entered or set to 0
$price = __( ‘FREE’, ‘woocommerce’ );
}
return $price;
}Thank you very much!
-
April 10, 2023 at 7:38 PM #190632Sangita Support SquadKeymaster
The team is looking into the matter . Kindly provide them some time.
-
April 11, 2023 at 4:03 AM #190656ChrisParticipant
Okay noted. Thank you so much!
-
April 11, 2023 at 6:27 PM #190688promitaKeymaster
Hi @Chris, You need to overwrite mvx-vendor-membership_template_vendor_plan.php template file and replace the code of line no 96 with this below code
<div class="wvm_price wvm_price_<?php echo $index; ?>" style="color: <?php echo get_mvx_vendor_settings('_plan_price_color', 'payment_membership_design'); ?>"><?php echo ($product->get_regular_price() == 0 || empty($product->get_regular_price())) ? __( 'FREE', 'mvx-pro' ) : wc_price($initial_billing_amt); ?></div>
Copy -
April 13, 2023 at 3:52 PM #190828ChrisParticipant
Hi @promita,
Thanks for the information and code provided. I’ve tested and it works.
However, I have 2 questions here to clear my doubts.
1) To prevent from overwriting it again on the next update of mvx pro, I should override this template, mvx-vendor-membership_template_vendor_plan.php in my child theme right?
2) The notes on the template file wrote this “Override this template by copying it to yourtheme/mvx-vendor-membership/mvx-vendor-membership_template_vendor_plan.php”. Does this mean that I have to add a new file named mvx-vendor-membership in my child theme and then upload the overwritten “mvx-vendor-membership_template_vendor_plan.php” into the file? -
April 13, 2023 at 10:09 PM #190862NerdySupportExpert MoumitaKeymaster
Hi @Chris, yes you are right for both procedure.
Let us know if you need any further help. -
April 20, 2023 at 12:18 PM #191151ChrisParticipant
Hi, thanks for clarifying. Anyway, I replaced the line of code mentioned previously through ftp access, which will work until the next update. However, I need some help here. I’d prefer to use the Code Snippets plugin for any child theme related customization for a hassle-free experience. I tried to copy and add the whole modified mvx-vendor-membership_template_vendor_plan.php template using the plugin but not sure why it couldn’t override. Is it possible if I want to request some php function codes or anything regarding to text customization so that I can refer to it and modify any parts of whenever I wanted to do so.
Thanks.
-
April 21, 2023 at 6:07 PM #191226NerdySupportExpert MoumitaKeymaster
@Chris, you can override the template only if you edit this via theme.
Currently, we don’t have a hook/filter for those parts. I have requested the team to check whether we can add such filter in our next update/
-
April 23, 2023 at 9:01 AM #191268ChrisParticipant
Alright, noted. Thanks for the help. Btw is this the link that showing all the available hooks? https://github.com/multivendorx/dc-woocommerce-multi-vendor/blob/master/classes/class-wcmp-vendor-hooks.php
If there is any other available docs or hooks/filters directory which I missed it out in my own searching, please guide me thanks! -
April 23, 2023 at 6:11 PM #191281ChrisParticipant
Hi moumita,
I have another question here regarding to overriding it via child theme. I checked on some php files and noticed that only files in the templates file have the comments: “Override this template by copying it to yourtheme/mvx-vendor-membership/mvx-vendor-membership_template_vendor_plan.php”. Some other php files which I’m interested in making some changes doesn’t have this type of comments. So, my question is:
1) If I want to customize some text and add some css styling, but the php files doesn’t have the comments:“Override this template by copying it to yourtheme/mvx-vendor-membership/mvx-vendor-membership_template_vendor_plan.php”, does this means that the changes will gone too when the plugin is updated even if I’m doing the same way by uploading the modified file into my child theme?Thanks for the help.
-
April 24, 2023 at 12:52 PM #191301NerdySupportExpert MoumitaKeymasterThis reply has been marked as private.
-
April 26, 2023 at 8:04 PM #191422ChrisParticipant
Okay, thank you for the information.
-
April 27, 2023 at 9:47 AM #191447Sangita Support SquadKeymaster
Hope your query is solved . We are closing this thread as of now . If you face issue or need help in future please create a new thread.
-
-
AuthorPosts
The topic ‘Help to Complete My Custom Code’ is closed to new replies.