• I have several issues I’m trying to resolve and haven’t had luck finding instructions or forum details. Thanks in advance for any links or coding suggestions you can help with.

    Brief explanation of project – client needs to charge classifieds based on number of characters. Process starts on this page – https://test.cdaonline.org/product/test/

    The character counter (a NinjaForms form) automatically selects the package needed by character count and then Ninja redirects to the appropriate Woocommerce product based on the drop-down selector. These are handled by the WPAdverts “Custom Fields” and “WooCommerce Payments” modules.

    On the products pages, the proper custom form is loaded in by shortcode to ensure the right Woocommerce product has the correct character count settings on the DESCRIPTION field.

    All that is working… incredibly.

    Here’s the issues I need assistance with…
    * How do I remove the Duration of ad (months) dropdown? It is required to be set and has nothing to do with the purchase. I would like it to be used for someone to purchase an ad for multiple months, especially the option to ongoing subscription (not ending until stopped in the control panel) but I haven’t figured out how to do that. The Duration of Ad drop-down is NOT in the form builder so I’m not even sure how it’s in my custom form. Changing to more than 1 has no impact on purchase price.

    * Listing Information. I shouldn’t need to set this because the product is created using that ‘listing’ form already. The shortcode is [adverts_add form_scheme=”classifieds-package-1″] and it does pull in the proper form, but then the listing option is still required. I can copy the data from the initial form into the WPAdverts form using $form->set_value but I haven’t been able to figure out how to set that for the listing type and I don’t want customers being able to edit that at all… it defeats the purpose of them going to the Woocommerce packages I created.

    Thanks again for any suggestions or links with solutions.

    John
    Digipark

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    1. the “Duration of ad (months)” field is not a standard WPAdverts field, so if you do not see it in the Custom Fields editor i do not know as well where it is coming from.

    It is possible that the field was added using adverts_form_load filter, you can check in your theme functions.php file if the code isn’t there?

    2. the value in listing type field you can set with adverts_form_bind filter and the value in your case would be the global get_the_ID() if i am not mistaken so the whole code would be

    
    add_filter( "adverts_form_bind", "bind_default_pricing", 10000 );
    function bind_default_pricing( $form ) {
        $form->set_value("payments_listing_type", get_the_ID());
        return $form;
    }
    

    Note as a priority i am using 10000 so the payments_listing_type field can be loaded by WPAdverts WC first.

    I understand you do not want to allow users to select a listing type as it was already selected for them, the easiest way to do it is to hide it with CSS, adding the code below in wp-admin / Appearance / Customize / Additional CSS panel will do it

    
    .adverts-field-name-payments_listing_type, 
    .adverts-field-name-_listing_information {
        display: none !important;
    }
    
    Thread Starter John Powell

    (@digipark)

    Hi Greg,

    Thanks for your help!

    1) Yes I’d added phone and duration fields when I first set this up a long time ago. I totally forgot about it. I found where I’d added it. I can add phone back in on the form builder where it should be now.

    2) I can’t get this to work. It doesn’t seem to set the radio button. The form initially is allowed to be submitted but when you go to pay for the ad I get this…

    Ooops! ??
    Selected Listing Type does not exist or could not be loaded.

    I’m using $product->get_id() in another function (with a global $product) but that didn’t seem to affect the listing type either. I use form->set_value for post_content (the description field) and that works.

    Any other thoughts on this?

    The css worked great. Thank you. I just need to figure out how to set the value so the payment process can complete. Hopefully you have another thought on the payments_listing_type issue.

    Thanks again for your help!

    John

    PS How is the subscriptions module coming along? We’d be interested in it!

    Thread Starter John Powell

    (@digipark)

    Greg,

    When you have a moment I’d still like to know if there’s a way to preload the value (#2 issue above) but I figured out I can set it in jQuery so I’ve got it working.

    I’d also like to know if there is news on the subscription module.

    Thank you much!!
    John

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    ok great i am glad you have it resolved.

    By subscriptions module do you mean the Memberships extension? It is still kind of beta, we have few users using it and they are reporting some issues.

    I am hoping to release a stable version along with the redesign for https://wpadverts.com/ which should be somewhere in August (probably middle or the end of August).

    Thread Starter John Powell

    (@digipark)

    Hi Greg,

    Yes the jQuery set radio function worked great, even when it’s hidden in css.

    Yes the Memberships extension. Thanks for the update. My client has people that pay every single month so this will be a good extension for them once it is operational.

    John M Powell
    Digipark

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Woocommerce / Custom Fields’ is closed to new replies.